summaryrefslogtreecommitdiffstats
path: root/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio
diff options
context:
space:
mode:
Diffstat (limited to 'meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio')
-rw-r--r--meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/board_gpio_rev_table.py33
-rw-r--r--meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/board_gpio_table_v1.py107
-rw-r--r--meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/board_gpio_table_v2.py118
-rw-r--r--meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/data/wedge100-BMC-GPIO-DVT.csv104
-rw-r--r--meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/data/wedge100-BMC-GPIO-EVT.csv83
-rw-r--r--meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/openbmc_gpio_setup.py75
-rw-r--r--meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/setup_board.py22
-rw-r--r--meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/wedge100_gpio_parse.py102
-rw-r--r--meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/openbmc-gpio_%.bbappend36
9 files changed, 680 insertions, 0 deletions
diff --git a/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/board_gpio_rev_table.py b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/board_gpio_rev_table.py
new file mode 100644
index 0000000..353944e
--- /dev/null
+++ b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/board_gpio_rev_table.py
@@ -0,0 +1,33 @@
+# Copyright 2015-present Facebook. All rights reserved.
+#
+# This program file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program in a file named COPYING; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301 USA
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+from openbmc_gpio_table import BoardGPIO
+
+# The fallowing table is generated using:
+# python wedge100_gpio_parser.py data/wedge100-BMC-gpio.csv
+# DO NOT MODIFY THE TABLE!!!
+# Manual modification will be overridden!!!
+
+board_gpio_rev_table = [
+ BoardGPIO('GPIOY0', 'BOARD_REV_ID0'),
+ BoardGPIO('GPIOY1', 'BOARD_REV_ID1'),
+ BoardGPIO('GPIOY2', 'BOARD_REV_ID2'),
+]
diff --git a/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/board_gpio_table_v1.py b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/board_gpio_table_v1.py
new file mode 100644
index 0000000..d51bafb
--- /dev/null
+++ b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/board_gpio_table_v1.py
@@ -0,0 +1,107 @@
+# Copyright 2015-present Facebook. All rights reserved.
+#
+# This program file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program in a file named COPYING; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301 USA
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+from openbmc_gpio_table import BoardGPIO
+
+
+# The fallowing table is generated using:
+# python wedge100_gpio_parser.py data/wedge100-BMC-gpio.csv
+# DO NOT MODIFY THE TABLE!!!
+# Manual modification will be overridden!!!
+
+board_gpio_table_v1 = [
+ BoardGPIO('GPIOB0', 'PANTHER_I2C_ALERT_N'),
+ BoardGPIO('GPIOB1', 'MSERV_NIC_SMBUS_ALERT_N'),
+ BoardGPIO('GPIOB2', 'DEBUG_PORT_UART_SEL_N'),
+ BoardGPIO('GPIOB4', 'LED_POSTCODE_4'),
+ BoardGPIO('GPIOB5', 'LED_POSTCODE_5'),
+ BoardGPIO('GPIOB6', 'LED_POSTCODE_6'),
+ BoardGPIO('GPIOB7', 'LED_POSTCODE_7'),
+ BoardGPIO('GPIOC2', 'ISO_BUF_EN'),
+ BoardGPIO('GPIOD0', 'BMC_PWR_BTN_IN_N'),
+ BoardGPIO('GPIOD1', 'BMC_PWR_BTN_OUT_N'),
+ BoardGPIO('GPIOD2', 'BMC_CPLD_RESET1'),
+ BoardGPIO('GPIOD3', 'BMC_CPLD_RESET2'),
+ BoardGPIO('GPIOD4', 'BMC_CPLD_RESET3'),
+ BoardGPIO('GPIOD5', 'BMC_CPLD_RESET4'),
+ BoardGPIO('GPIOD7', 'BMC_CPLD_QSFP_INT'),
+ BoardGPIO('GPIOE0', 'DEBUG_UART_SEL_0'),
+ BoardGPIO('GPIOE2', 'SWITCH_EEPROM1_WRT'),
+ BoardGPIO('GPIOE4', 'ISO_MICROSRV_PRSNT_N'),
+ BoardGPIO('GPIOE5', 'LED_PWR_BLUE'),
+ BoardGPIO('GPIOF0', 'MSERVE_ISOBUF_EN'),
+ BoardGPIO('GPIOF1', 'BMC_MAIN_RESET_N'),
+ BoardGPIO('GPIOF2', 'CPLD_JTAG_SEL'),
+ BoardGPIO('GPIOF4', 'MSERV_POWERUP'),
+ BoardGPIO('GPIOF5', 'RCKMON_RS485_DE'),
+ BoardGPIO('GPIOG0', 'LED_POSTCODE_0'),
+ BoardGPIO('GPIOG1', 'LED_POSTCODE_1'),
+ BoardGPIO('GPIOG2', 'LED_POSTCODE_2'),
+ BoardGPIO('GPIOG3', 'LED_POSTCODE_3'),
+ BoardGPIO('GPIOG4', 'BMC_WDTRST1'),
+ BoardGPIO('GPIOG5', 'BMC_WDTRST2'),
+ BoardGPIO('GPIOH3', 'QSFP_LED_POSITION'),
+ BoardGPIO('GPIOH4', 'PM_SM_ALERT_N'),
+ BoardGPIO('GPIOI4', 'BMC_EEPROM1_SPI_SS'),
+ BoardGPIO('GPIOI5', 'BMC_EEPROM1_SPI_SCK'),
+ BoardGPIO('GPIOI6', 'BMC_EEPROM1_SPI_MOSI'),
+ BoardGPIO('GPIOI7', 'BMC_EEPROM1_SPI_MISO'),
+ BoardGPIO('GPIOJ0', 'RCKMON_SPARE0'),
+ BoardGPIO('GPIOJ1', 'RCKMON_SPARE1'),
+ BoardGPIO('GPIOJ2', 'RCKMON_SPARE2'),
+ BoardGPIO('GPIOJ3', 'RCKMON_SPARE3'),
+ BoardGPIO('GPIOJ4', 'FANCARD_CPLD_TMS'),
+ BoardGPIO('GPIOJ5', 'FANCARD_CPLD_TCK'),
+ BoardGPIO('GPIOJ6', 'FANCARD_CPLD_TDI'),
+ BoardGPIO('GPIOJ7', 'FANCARD_CPLD_TDO'),
+ BoardGPIO('GPIOL5', 'BMC_UART_1_RTS'),
+ BoardGPIO('GPIOM0', 'CPLD_UPD_EN'),
+ BoardGPIO('GPIOM1', 'SMB_ALERT'),
+ BoardGPIO('GPIOM3', 'TH_POWERUP'),
+ BoardGPIO('GPIOM4', 'BMC_CPLD_TMS'),
+ BoardGPIO('GPIOM5', 'BMC_CPLD_TDI'),
+ BoardGPIO('GPIOM6', 'BMC_CPLD_TCK'),
+ BoardGPIO('GPIOM7', 'BMC_CPLD_TDO'),
+ BoardGPIO('GPIOO0', 'RCKMON_SPARE4'),
+ BoardGPIO('GPIOO1', 'RCKMON_SPARE5'),
+ BoardGPIO('GPIOO2', 'RCKMON_SPARE10'),
+ BoardGPIO('GPIOO3', 'RCKMON_SPARE11'),
+ BoardGPIO('GPIOO4', 'RCKMON_SPARE8'),
+ BoardGPIO('GPIOO5', 'RCKMON_SPARE9'),
+ BoardGPIO('GPIOO6', 'RCKMON_SPARE6'),
+ BoardGPIO('GPIOO7', 'RCKMON_SPARE7'),
+ BoardGPIO('GPIOP0', 'RMON1_PF'),
+ BoardGPIO('GPIOP1', 'RMON1_RF'),
+ BoardGPIO('GPIOP2', 'RMON2_PF'),
+ BoardGPIO('GPIOP3', 'RMON2_RF'),
+ BoardGPIO('GPIOP4', 'RMON3_PF'),
+ BoardGPIO('GPIOP5', 'RMON3_RF'),
+ BoardGPIO('GPIOP6', 'FANCARD_I2C_ALARM'),
+ BoardGPIO('GPIOP7', 'BMC_READY_N'),
+ BoardGPIO('GPIOQ4', 'BMC_CPLD_POWER_INT'),
+ BoardGPIO('GPIOQ5', 'BMC_CPLD_SPARE7'),
+ BoardGPIO('GPIOQ6', 'USB_OCS_N1'),
+ BoardGPIO('GPIOQ7', 'BMC_HEARTBEAT_N'),
+ BoardGPIO('GPIOR0', 'SPI_IBMC_BT_CS1_N_R'),
+ BoardGPIO('GPIOR6', 'SWITCH_MDC'),
+ BoardGPIO('GPIOR7', 'SWITCH_MDIO'),
+ BoardGPIO('GPIOS0', 'BMC_SPI_WP_N'),
+]
diff --git a/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/board_gpio_table_v2.py b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/board_gpio_table_v2.py
new file mode 100644
index 0000000..a95ecf4
--- /dev/null
+++ b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/board_gpio_table_v2.py
@@ -0,0 +1,118 @@
+# Copyright 2015-present Facebook. All rights reserved.
+#
+# This program file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program in a file named COPYING; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301 USA
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+from openbmc_gpio_table import BoardGPIO
+
+
+# The fallowing table is generated using:
+# python wedge100_gpio_parser.py data/wedge100-BMC-gpio.csv
+# DO NOT MODIFY THE TABLE!!!
+# Manual modification will be overridden!!!
+
+board_gpio_table_v2 = [
+ BoardGPIO('GPIOB0', 'PANTHER_I2C_ALERT_N'),
+ BoardGPIO('GPIOB1', 'MSERV_NIC_SMBUS_ALERT_N'),
+ BoardGPIO('GPIOB2', 'DEBUG_PORT_UART_SEL_N'),
+ BoardGPIO('GPIOB5', 'LED_POSTCODE_5'),
+ BoardGPIO('GPIOB6', 'LED_POSTCODE_6'),
+ BoardGPIO('GPIOB7', 'LED_POSTCODE_7'),
+ BoardGPIO('GPIOC2', 'ISO_BUF_EN'),
+ BoardGPIO('GPIOD0', 'BMC_PWR_BTN_IN_N'),
+ BoardGPIO('GPIOD1', 'BMC_PWR_BTN_OUT_N'),
+ BoardGPIO('GPIOD2', 'BMC_CPLD_RESET1'),
+ BoardGPIO('GPIOD3', 'BMC_CPLD_RESET2'),
+ BoardGPIO('GPIOD4', 'BMC_CPLD_RESET3'),
+ BoardGPIO('GPIOD5', 'BMC_CPLD_RESET4'),
+ BoardGPIO('GPIOD7', 'BMC_CPLD_QSFP_INT'),
+ BoardGPIO('GPIOE0', 'DEBUG_UART_SEL_0'),
+ BoardGPIO('GPIOE2', 'SWITCH_EEPROM1_WRT'),
+ BoardGPIO('GPIOE4', 'ISO_MICROSRV_PRSNT_N'),
+ BoardGPIO('GPIOE5', 'LED_PWR_BLUE'),
+ BoardGPIO('GPIOF0', 'MSERVE_ISOBUF_EN'),
+ BoardGPIO('GPIOF1', 'BMC_MAIN_RESET_N'),
+ BoardGPIO('GPIOF2', 'CPLD_JTAG_SEL'),
+ BoardGPIO('GPIOF4', 'MSERV_POWERUP'),
+ BoardGPIO('GPIOF5', 'BMC_UART_4_RTS'),
+ BoardGPIO('GPIOG0', 'LED_POSTCODE_0'),
+ BoardGPIO('GPIOG1', 'LED_POSTCODE_1'),
+ BoardGPIO('GPIOG2', 'LED_POSTCODE_2'),
+ BoardGPIO('GPIOG3', 'LED_POSTCODE_3'),
+ BoardGPIO('GPIOG4', 'BMC_WDTRST1'),
+ BoardGPIO('GPIOG5', 'BMC_WDTRST2'),
+ BoardGPIO('GPIOG6', 'BMC_COM_NIC_ISOBUF_EN'),
+ BoardGPIO('GPIOG7', 'BMC_COM_PANTHER_ISOBUF_EN'),
+ BoardGPIO('GPIOH3', 'QSFP_LED_POSITION'),
+ BoardGPIO('GPIOH4', 'PM_SM_ALERT_N'),
+ BoardGPIO('GPIOI4', 'BMC_EEPROM1_SPI_SS'),
+ BoardGPIO('GPIOI5', 'BMC_EEPROM1_SPI_SCK'),
+ BoardGPIO('GPIOI6', 'BMC_EEPROM1_SPI_MOSI'),
+ BoardGPIO('GPIOI7', 'BMC_EEPROM1_SPI_MISO'),
+ BoardGPIO('GPIOJ0', 'RCKMON_SPARE0'),
+ BoardGPIO('GPIOJ1', 'RCKMON_SPARE1'),
+ BoardGPIO('GPIOJ2', 'RCKMON_SPARE2'),
+ BoardGPIO('GPIOJ3', 'RCKMON_SPARE3'),
+ BoardGPIO('GPIOJ4', 'FANCARD_CPLD_TMS'),
+ BoardGPIO('GPIOJ5', 'FANCARD_CPLD_TCK'),
+ BoardGPIO('GPIOJ6', 'FANCARD_CPLD_TDI'),
+ BoardGPIO('GPIOJ7', 'FANCARD_CPLD_TDO'),
+ BoardGPIO('GPIOL5', 'BMC_UART_1_RTS'),
+ BoardGPIO('GPIOM0', 'CPLD_UPD_EN'),
+ BoardGPIO('GPIOM1', 'SMB_ALERT'),
+ BoardGPIO('GPIOM3', 'TH_POWERUP'),
+ BoardGPIO('GPIOM4', 'BMC_CPLD_TMS'),
+ BoardGPIO('GPIOM5', 'BMC_CPLD_TDI'),
+ BoardGPIO('GPIOM6', 'BMC_CPLD_TCK'),
+ BoardGPIO('GPIOM7', 'BMC_CPLD_TDO'),
+ BoardGPIO('GPION0', 'ISO_COM_SUS_S3_N'),
+ BoardGPIO('GPION1', 'ISO_COM_SUS_S4_N'),
+ BoardGPIO('GPION2', 'ISO_COM_SUS_S5_N'),
+ BoardGPIO('GPION3', 'ISO_COM_SUS_STAT_N'),
+ BoardGPIO('GPION4', 'ISO_COM_BRG_WDT'),
+ BoardGPIO('GPION5', 'BRG_COM_BIOS_DIS0_N'),
+ BoardGPIO('GPION6', 'BRG_COM_BIOS_DIS1_N'),
+ BoardGPIO('GPION7', 'ISO_COM_PWROK'),
+ BoardGPIO('GPIOO0', 'COM_SPI_SEL'),
+ BoardGPIO('GPIOO1', 'COM6_BUF_EN'),
+ BoardGPIO('GPIOO2', 'RCKMON_SPARE4'),
+ BoardGPIO('GPIOO3', 'RCKMON_SPARE5'),
+ BoardGPIO('GPIOO4', 'TPM_SPI_SEL'),
+ BoardGPIO('GPIOO5', 'TPM_SPI_BUF_EN'),
+ BoardGPIO('GPIOO6', 'ISO_BRG_THRMTRIP_N'),
+ BoardGPIO('GPIOO7', 'ISO_BRG_THRM_N'),
+ BoardGPIO('GPIOP0', 'RMON1_PF'),
+ BoardGPIO('GPIOP1', 'RMON1_RF'),
+ BoardGPIO('GPIOP2', 'RMON2_PF'),
+ BoardGPIO('GPIOP3', 'RMON2_RF'),
+ BoardGPIO('GPIOP4', 'RMON3_PF'),
+ BoardGPIO('GPIOP5', 'RMON3_RF'),
+ BoardGPIO('GPIOP6', 'FANCARD_I2C_ALARM'),
+ BoardGPIO('GPIOP7', 'BMC_READY_N'),
+ BoardGPIO('GPIOQ4', 'BMC_CPLD_POWER_INT'),
+ BoardGPIO('GPIOQ5', 'BMC_CPLD_SPARE7'),
+ BoardGPIO('GPIOQ6', 'USB_OCS_N1'),
+ BoardGPIO('GPIOQ7', 'BMC_HEARTBEAT_N'),
+ BoardGPIO('GPIOR0', 'SPI_IBMC_BT_CS1_N_R'),
+ BoardGPIO('GPIOR6', 'SWITCH_MDC'),
+ BoardGPIO('GPIOR7', 'SWITCH_MDIO'),
+ BoardGPIO('GPIOS0', 'BMC_SPI_WP_N'),
+ BoardGPIO('GPIOY3', 'LED_POSTCODE_4'),
+]
+
diff --git a/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/data/wedge100-BMC-GPIO-DVT.csv b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/data/wedge100-BMC-GPIO-DVT.csv
new file mode 100644
index 0000000..1ded15c
--- /dev/null
+++ b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/data/wedge100-BMC-GPIO-DVT.csv
@@ -0,0 +1,104 @@
+J21,GPIOB0_SALT1,In,PANTHER_I2C_ALERT_N,panther i2c alert_n
+J20,GPIOB1_SALT2,In,MSERV_NIC_SMBUS_ALERT_N,"micro server NIC SMBUS alert_n, active low"
+H18,GPIOB2_SALT3,In,DEBUG_PORT_UART_SEL_N,The DEBUG_PORT_UART_SEL_N is connected to a push button in the front panel. When Debug port select button in Front panel is pressed DEBUG_PORT_UART_SEL_N becomes low.
+E19,GPIOB4_LPCRST_N,Out,LPC_RST_N,Signal to reset LPC
+H19,GPIOB5_LPCPD_N_LPCSMI_N,Out,LED_POSTCODE_5,LED 7-segment code bit-5 for facebook debug header
+H20,GPIOB6_LPCPME_N,Out,LED_POSTCODE_6,LED 7-segment code bit-6 for facebook debug header
+E18,GPIOB7_EXTRST_N_SPICS1_N,Out,LED_POSTCODE_7,LED 7-segment code bit-7 for facebook debug header
+A2,GPIOC2_SD1DAT0_SCL11,Out,ISO_BUF_EN,"reserved for ISO_BUFFER control, in default serial resister is depop, use CPLD to control"
+A18,GPIOD0_SD2CLK,,BMC_PWR_BTN_IN_N,to emulate Microserver power button function using BMC
+D16,GPIOD1_SD2CMD,,BMC_PWR_BTN_OUT_N,
+B17,GPIOD2_SD2DAT0,Out,BMC_CPLD_RESET1,Spare Reset signal connected to CPLD
+A17,GPIOD3_SD2DAT1,Out,BMC_CPLD_RESET2,Spare Reset signal connected to CPLD
+C16,GPIOD4_SD2DAT2,Out,BMC_CPLD_RESET3,Spare Reset signal connected to CPLD (USB_BRDG RST function moved to CPLD)
+B16,GPIOD5_SD2DAT3,Out,BMC_CPLD_RESET4,Spare Reset signal connected to CPLD
+E15,GPIOD7_SD2WP_N,In,BMC_CPLD_QSFP_INT,Intrerrupt from CPLD to BMC for any QSFP events (USB RESET function moved to CPLD)
+D15,GPIOE0_NCTS3,Out,DEBUG_UART_SEL_0,FB debug connector UART select 0: BMC uART 1: microserver UART
+B15,GPIOE2_NDSR3,out,SWITCH_EEPROM1_WRT,"0: BCM5387 SPI interface connect to SPI EEPROM
+1: BCM5387 SPI interface connect to BMC SPI EEPROM interface
+this bit is used as BCM5387 straping configuration too"
+E14,GPIOE4_NDTR3,in,ISO_MICROSRV_PRSNT_N,"0: Microserver is present in PCIe slot
+1: microserver is not present in PCIe slot"
+D14,GPIOE5_NRTS3,out,LED_PWR_BLUE,"Power LED blue will be ON when LED_PWR_BLUE is high.
+Power LED blue will be off when LED_PWR_BLUE is low"
+D18,GPIOF0_NCTS4,Out,MSERVE_ISOBUF_EN,To enable isolation buffer dedicated for microserver com port
+B19,GPIOF1_NDCD4_SIOPBI_N,Out,BMC_MAIN_RESET_N,BMC can request cpld to reset main power
+A20,GPIOF2_NDSR4_SIOPWRGD,Out,CPLD_JTAG_SEL,"SYSCPLD upgrade enable, 0: jtag header program, 1: BMC programming"
+B18,GPIOF4_NDTR4,Out,MSERV_POWERUP,To request cpld to turn on P12_uServer for microserver
+A19,GPIOF5_NRTS4_SIOSCI_N,Out,BMC_UART_4_RTS,BMC com port 4 rts to cpld
+E16,GPIOF6_TXD4,In,BMC_UART_4_TX,BMC com port to cpld
+C17,GPIOF7_RXD4,Out,BMC_UART_4_RX,BMC com port to cpld
+A14,GPIOG0_SGPSCK,Out,LED_POSTCODE_0,LED 7-segment code bit-0 for facebook debug header
+E13,GPIOG1_SGPSLD,Out,LED_POSTCODE_1,LED 7-segment code bit-1 for facebook debug header
+D13,GPIOG2_SGPSI0,Out,LED_POSTCODE_2,LED 7-segment code bit-2 for facebook debug header
+C13,GPIOG3_SGPSI1,Out,LED_POSTCODE_3,LED 7-segment code bit-3 for facebook debug header
+B13,GPIOG4_WDTRST1_OSCCLK,Out,BMC_WDTRST1,Watch dog timer reset1 output from BMC to CPLD
+Y21,GPIOG5_WDTRST2_USBCKI,Out,BMC_WDTRST2,Watch dog timer reset2 output from BMC to CPLD
+AA22,GPIOG6_FLBUSY_N,Out,BMC_COM_NIC_ISOBUF_EN,Active low signal to enable the isolation buffer for SMBUS to COMe
+U18,GPIOG7_FLWP_N,Out,BMC_COM_PANTHER_ISOBUF_EN,Active low signal to enable the isolation buffer for I2C BUS to COMe
+A7,GPIOH3_ROMD11_NRI6,In,QSFP_LED_POSITION,QSFP position select input
+D7,GPIOH4_ROMD12_NDTR6,In,PM_SM_ALERT_N,SM bus alert from power manager (also connected to CPLD)
+C22,GPIOI0_SYSCS_N,Out,BMC_TPM_SPI_CS_N,BMC SPI interface to SPI based TPM
+G18,GPIOI1_SYSCK,Out,BMC_TPM_SPI_CLK,BMC SPI interface to SPI based TPM
+D19,GPIOI2_SYSDO,Out,BMC_TPM_SPI_MOSI,BMC SPI interface to SPI based TPM
+C20,GPIOI3_SYSDI,In,BMC_TPM_SPI_MISO,BMC SPI interface to SPI based TPM
+B22,GPIOI4_SPICS0_N_VBCS_N,Out,BMC_EEPROM1_SPI_SS,"BMC SPI EEPROM interface connect to BCM5387 switch if SWITCH_EEPRM1_WRT is 1, "
+G19,GPIOI5_SPICK_VBCK,Out,BMC_EEPROM1_SPI_SCK,
+C18,GPIOI6_SPIDO_VBDO,Out,BMC_EEPROM1_SPI_MOSI,
+E20,GPIOI7_SPIDI_VBDI,In,BMC_EEPROM1_SPI_MISO,
+J5,GPIOJ0_SGPMCK,Bi,RCKMON_SPARE0,Spare gpios to rack mon card
+J4,GPIOJ1_SGPMLD,Bi,RCKMON_SPARE1,Spare gpios to rack mon card
+K5,GPIOJ2_SGPMO,Bi,RCKMON_SPARE2,Spare gpios to rack mon card
+J3,GPIOJ3_SGPMI,Bi,RCKMON_SPARE3,Spare gpios to rack mon card
+T4,VGAHS_GPIOJ4,,FANCARD_CPLD_TMS,"fancard CPLD JTAG upgrade interface, BMC output to CPLD TMS"
+U2,VGAVS_GPIOJ5,,FANCARD_CPLD_TCK,"fancard CPLD JTAG upgrade interface, BMC output to CPLD TCK"
+T2,DDCCLK_GPIOJ6,,FANCARD_CPLD_TDI,"fancard CPLD JTAG upgrade interface, BMC output to CPLD TDI"
+T1,DDCDAT_GPIOJ7,,FANCARD_CPLD_TDO,"fancard CPLD JTAG upgrade interface, BMC input to CPLD TDO"
+V2,GPIOL5_NRTS1_VPICLK,Out,BMC_UART_1_RTS,connect to SYSCPLD
+W1,GPIOL6_TXD1_VPIB0,Out,BMC_UART_TX_1,connect to SYSCPLD
+U5,GPIOL7_RXD1_VPIB1,In,BMC_UART_RX_1,connect to SYSCPLD
+V3,GPIOM0_NCTS2_VPIB2,Out,CPLD_UPD_EN,"fan_card CPLD upgrade enable, 0: jtag header programming, 1: BMC programming"
+W2,GPIOM1_NDCD2_VPIB3,In,SMB_ALERT,"Alert signal from cpld representing Alert from the power supplies(Vcore,vanlg,3.3)"
+V4,GPIOM3_NRI2_VPIB5,out,TH_POWERUP,"tomahawk power up enable, active high. Connect to CPLD, cpld will control pwr1014a"
+W3,GPIOM4_NDTR2_VPIB6,out,BMC_CPLD_TMS,"SYSCPLD CPLD JTAG upgrade interface, BMC output to SYSCPLD TMS"
+Y2,GPIOM5_NRTS2_VPIB7,out,BMC_CPLD_TDI,"SYSCPLD CPLD JTAG upgrade interface, BMC output to SYSCPLD TDI"
+AA1,GPIOM6_TXD2_VPIB8,out,BMC_CPLD_TCK,"SYSCPLD CPLD JTAG upgrade interface, BMC output to SYSCPLD TCK"
+V5,GPIOM7_RXD2_VPIB9,In,BMC_CPLD_TDO,"SYSCPLD CPLD JTAG upgrade interface, BMC output to SYSCPLD TDO"
+W4,GPION0_PWM0_VPIG0,In,ISO_COM_SUS_S3_N,s3 sleep signal from com(COME Signal)
+Y3,GPION1_PWM1_VPIG1,In,ISO_COM_SUS_S4_N,s4 sleep signal from com (COME Signal)
+AA2,GPION2_PWM2_VPIG2,In,ISO_COM_SUS_S5_N,s5 sleep signal from com (COME Signal)
+AB1,GPION3_PWM3_VPIG3,In,ISO_COM_SUS_STAT_N,suspend status signal from com (COME Signal)
+W5,GPION4_PWM4_VPIG4,In,ISO_COM_BRG_WDT,watch dog timer output from com(COME Signal)
+Y4,GPION5_PWM5_VPIG5,Out,BRG_COM_BIOS_DIS0_N,BMC can select the bootdevice of COM (COME Signal)
+AA3,GPION6_PWM6_VPIG6,Out,BRG_COM_BIOS_DIS1_N,BMC can select the bootdevice of COM (COME Signal)
+AB2,GPION7_PWM7_VPIG7,Out,ISO_COM_PWROK,com power ok signal from BMC (COME Signal)
+V6,GPIOO0_TACH0_VPIG8,Out,COM_SPI_SEL,"override signal from bmc to select bmc to upgrade com eeprom
+0:On board spi flash
+1:BMC can write into SPI flash"
+Y5,GPIOO1_TACH1_VPIG9,Out,COM6_BUF_EN,Active low signal to enable isolation buffer dedicated for com signals
+AA4,GPIOO2_TACH2_VPIR0,BI,RCKMON_SPARE4,RCKMON_SPARE[0:11] connect to fan_ctrl_rmon card connector
+AB3,GPIOO3_TACH3_VPIR1,BI,RCKMON_SPARE5,RCKMON_SPARE[0:11] connect to fan_ctrl_rmon card connector
+W6,GPIOO4_TACH4_VPIR2,Out,TPM_SPI_SEL,Signal from BMC to select whether BMC or COM SPI should go to TPM module. By default COM SPI is Selected. BMC can drive this signal high to select SPI from BMC
+AA5,GPIOO5_TACH5_VPIR3,Out,TPM_SPI_BUF_EN,Signal from BMC to enable or disable the MUX which selects BMC or COM SPI to TPM module. Default the MUX is enabled .BMC can drive high to disable it.
+AB4,GPIOO6_TACH6_VPIR4,In,ISO_BRG_THRMTRIP_N,"Active low Signal from COM to indicate processor over heating ,and com will go into s5 state (COME Signal)"
+V7,GPIOO7_TACH7_VPIR5,Out,ISO_BRG_THRM_N,Active low Signal from BMC to indicate overtemperature (COME Signal)
+Y6,GPIOP0_TACH8_VPIR6,In,RMON1_PF,"rack 1 monitor status, Power Failure, active low"
+AB5,GPIOP1_TACH9_VPIR7,In,RMON1_RF,"rack 1 monitor status, redudancy Failure, active low"
+W7,GPIOP2_TACH10_VPIR8,In,RMON2_PF,"rack 2 monitor status, Power Failure, active low"
+AA6,GPIOP3_TACH11_VPIR9,In,RMON2_RF,"rack 2 monitor status, redudancy Failure, active low"
+AB6,GPIOP4_TACH12,In,RMON3_PF,"rack 3 monitor status, Power Failure, active low"
+Y7,GPIOP5_TACH13,In,RMON3_RF,"rack 3 monitor status, redudancy Failure, active low"
+AA7,GPIOP6_TACH14_BMCINT,In,FANCARD_I2C_ALARM,"fan card alarm input, active low"
+AB7,GPIOP7_TACH15_FLACK,out,BMC_READY_N,"0: BMC is ready for service. 1: BMC is not ready, or during initialization"
+H4,GPIOQ4_SCL14,In,BMC_CPLD_POWER_INT,Intrerrupt from CPLD to BMC for any Power events
+H3,GPIOQ5_SDA14,,BMC_CPLD_SPARE7,Spare GPIOs to CPLD
+H2,GPIOQ6,out,USB_OCS_N1,over-current sense output to USB2513 hub
+H1,GPIOQ7,out,BMC_HEARTBEAT_N,BMC heatbeat output to onboard heartbeat LED
+V20,GPIOR0_ROMCS1_N,out,SPI_IBMC_BT_CS1_N_R,chip select to secondary boot SPI flash
+C6,GPIOR6_MDC1,BI,SWITCH_MDC,MDC/MDIO to GE Switch
+A5,GPIOR7_MDIO1,BI,SWITCH_MDIO,
+U21,ROMD4_GPIOS0_VPODE,Out,BMC_SPI_WP_N,Write protect for Secondary Boot Flash. Connected to CPLD. CPLD will drive it to the flash chip
+C21,GPIOY0_SIOS3_N,In,BOARD_REV_ID0,"Board ID input bit0, resister straping, connect to both BMC and CPLD"
+F20,GPIOY1_SIOS5_N,In,BOARD_REV_ID1,"Board ID input bit1, resister straping, connect to both BMC and CPLD"
+G20,GPIOY2_SIOPWREQ_N,In,BOARD_REV_ID2,"Board ID input bit2, resister straping, connect to both BMC and CPLD"
+K20,GPIOY3_SIOONCTRL_N,,LED_POSTCODE_4,LED 7-segment code bit-4 for facebook debug header \ No newline at end of file
diff --git a/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/data/wedge100-BMC-GPIO-EVT.csv b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/data/wedge100-BMC-GPIO-EVT.csv
new file mode 100644
index 0000000..781d739
--- /dev/null
+++ b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/data/wedge100-BMC-GPIO-EVT.csv
@@ -0,0 +1,83 @@
+J21,GPIOB0_SALT1,In,PANTHER_I2C_ALERT_N,panther i2c alert_n
+J20,GPIOB1_SALT2,In,MSERV_NIC_SMBUS_ALERT_N,"micro server NIC SMBUS alert_n, active low"
+H18,GPIOB2_SALT3,In,DEBUG_PORT_UART_SEL_N,The DEBUG_PORT_UART_SEL_N is connected to a push button in the front panel. When Debug port select button in Front panel is pressed DEBUG_PORT_UART_SEL_N becomes low.
+E19,GPIOB4_LPCRST_N,Out,LED_POSTCODE_4,LED 7-segment code bit-4 for facebook debug header
+H19,GPIOB5_LPCPD_N_LPCSMI_N,Out,LED_POSTCODE_5,LED 7-segment code bit-5 for facebook debug header
+H20,GPIOB6_LPCPME_N,Out,LED_POSTCODE_6,LED 7-segment code bit-6 for facebook debug header
+E18,GPIOB7_EXTRST_N_SPICS1_N,Out,LED_POSTCODE_7,LED 7-segment code bit-7 for facebook debug header
+A2,GPIOC2_SD1DAT0_SCL11,Out,ISO_BUF_EN,"reserved for ISO_BUFFER control, in default serial resister is depop, use CPLD to control"
+A18,GPIOD0_SD2CLK,,BMC_PWR_BTN_IN_N,to emulate Microserver power button function using BMC
+D16,GPIOD1_SD2CMD,,BMC_PWR_BTN_OUT_N,
+B17,GPIOD2_SD2DAT0,Out,BMC_CPLD_RESET1,Spare Reset signal connected to CPLD
+A17,GPIOD3_SD2DAT1,Out,BMC_CPLD_RESET2,Spare Reset signal connected to CPLD
+C16,GPIOD4_SD2DAT2,Out,BMC_CPLD_RESET3,Spare Reset signal connected to CPLD (USB_BRDG RST function moved to CPLD)
+B16,GPIOD5_SD2DAT3,Out,BMC_CPLD_RESET4,Spare Reset signal connected to CPLD
+E15,GPIOD7_SD2WP_N,In,BMC_CPLD_QSFP_INT,Intrerrupt from CPLD to BMC for any QSFP events (USB RESET function moved to CPLD)
+D15,GPIOE0_NCTS3,Out,DEBUG_UART_SEL_0,FB debug connector UART select 0: BMC uART 1: microserver UART
+B15,GPIOE2_NDSR3,out,SWITCH_EEPROM1_WRT,"0: BCM5387 SPI interface connect to SPI EEPROM
+1: BCM5387 SPI interface connect to BMC SPI EEPROM interface
+this bit is used as BCM5387 straping configuration too"
+E14,GPIOE4_NDTR3,in,ISO_MICROSRV_PRSNT_N,"0: Microserver is present in PCIe slot
+1: microserver is not present in PCIe slot"
+D14,GPIOE5_NRTS3,out,LED_PWR_BLUE,"Power LED blue will be ON when LED_PWR_BLUE is high.
+Power LED blue will be off when LED_PWR_BLUE is low"
+D18,GPIOF0_NCTS4,Out,MSERVE_ISOBUF_EN,To enable isolation buffer dedicated for microserver com port
+B19,GPIOF1_NDCD4_SIOPBI_N,Out,BMC_MAIN_RESET_N,BMC can request cpld to reset main power
+A20,GPIOF2_NDSR4_SIOPWRGD,Out,CPLD_JTAG_SEL,"SYSCPLD upgrade enable, 0: jtag header program, 1: BMC programming"
+B18,GPIOF4_NDTR4,Out,MSERV_POWERUP,To request cpld to turn on P12_uServer for microserver
+A19,GPIOF5_NRTS4,Out,RCKMON_RS485_DE,RS485 Drive Enable (TX/RX Toggle) pin for rackmon
+A14,GPIOG0_SGPSCK,Out,LED_POSTCODE_0,LED 7-segment code bit-0 for facebook debug header
+E13,GPIOG1_SGPSLD,Out,LED_POSTCODE_1,LED 7-segment code bit-1 for facebook debug header
+D13,GPIOG2_SGPSI0,Out,LED_POSTCODE_2,LED 7-segment code bit-2 for facebook debug header
+C13,GPIOG3_SGPSI1,Out,LED_POSTCODE_3,LED 7-segment code bit-3 for facebook debug header
+B13,GPIOG4_WDTRST1_OSCCLK,Out,BMC_WDTRST1,Watch dog timer reset1 output from BMC to CPLD
+Y21,GPIOG5_WDTRST2_USBCKI,Out,BMC_WDTRST2,Watch dog timer reset2 output from BMC to CPLD
+A7,GPIOH3_ROMD11_NRI6,In,QSFP_LED_POSITION,QSFP position select input
+D7,GPIOH4_ROMD12_NDTR6,In,PM_SM_ALERT_N,SM bus alert from power manager (also connected to CPLD)
+B22,GPIOI4_SPICS0_N_VBCS_N,Out,BMC_EEPROM1_SPI_SS,"BMC SPI EEPROM interface connect to BCM5387 switch if SWITCH_EEPRM1_WRT is 1, "
+G19,GPIOI5_SPICK_VBCK,Out,BMC_EEPROM1_SPI_SCK,
+C18,GPIOI6_SPIDO_VBDO,Out,BMC_EEPROM1_SPI_MOSI,
+E20,GPIOI7_SPIDI_VBDI,In,BMC_EEPROM1_SPI_MISO,
+J5,GPIOJ0_SGPMCK,Bi,RCKMON_SPARE0,Spare gpios to rack mon card
+J4,GPIOJ1_SGPMLD,Bi,RCKMON_SPARE1,Spare gpios to rack mon card
+K5,GPIOJ2_SGPMO,Bi,RCKMON_SPARE2,Spare gpios to rack mon card
+J3,GPIOJ3_SGPMI,Bi,RCKMON_SPARE3,Spare gpios to rack mon card
+T4,VGAHS_GPIOJ4,,FANCARD_CPLD_TMS,"fancard CPLD JTAG upgrade interface, BMC output to CPLD TMS"
+U2,VGAVS_GPIOJ5,,FANCARD_CPLD_TCK,"fancard CPLD JTAG upgrade interface, BMC output to CPLD TCK"
+T2,DDCCLK_GPIOJ6,,FANCARD_CPLD_TDI,"fancard CPLD JTAG upgrade interface, BMC output to CPLD TDI"
+T1,DDCDAT_GPIOJ7,,FANCARD_CPLD_TDO,"fancard CPLD JTAG upgrade interface, BMC input to CPLD TDO"
+V2,GPIOL5_NRTS1_VPICLK,Out,BMC_UART_1_RTS,connect to SYSCPLD
+V3,GPIOM0_NCTS2_VPIB2,Out,CPLD_UPD_EN,"fan_card CPLD upgrade enable, 0: jtag header programming, 1: BMC programming"
+W2,GPIOM1_NDCD2_VPIB3,In,SMB_ALERT,"Alert signal from cpld representing Alert from the power supplies(Vcore,vanlg,3.3)"
+V4,GPIOM3_NRI2_VPIB5,out,TH_POWERUP,"tomahawk power up enable, active high. Connect to CPLD, cpld will control pwr1014a"
+W3,GPIOM4_NDTR2_VPIB6,out,BMC_CPLD_TMS,"SYSCPLD CPLD JTAG upgrade interface, BMC output to SYSCPLD TMS"
+Y2,GPIOM5_NRTS2_VPIB7,out,BMC_CPLD_TDI,"SYSCPLD CPLD JTAG upgrade interface, BMC output to SYSCPLD TDI"
+AA1,GPIOM6_TXD2_VPIB8,out,BMC_CPLD_TCK,"SYSCPLD CPLD JTAG upgrade interface, BMC output to SYSCPLD TCK"
+V5,GPIOM7_RXD2_VPIB9,In,BMC_CPLD_TDO,"SYSCPLD CPLD JTAG upgrade interface, BMC output to SYSCPLD TDO"
+V6,GPIOO0_TACH0_VPIG8,BI,RCKMON_SPARE4,RCKMON_SPARE[0:11] connect to fan_ctrl_rmon card connector
+Y5,GPIOO1_TACH1_VPIG9,BI,RCKMON_SPARE5,RCKMON_SPARE[0:11] connect to fan_ctrl_rmon card connector
+AA4,GPIOO2_TACH2_VPIR0,BI,RCKMON_SPARE10,RCKMON_SPARE[0:11] connect to fan_ctrl_rmon card connector(now not connected)
+AB3,GPIOO3_TACH3_VPIR1,BI,RCKMON_SPARE11,RCKMON_SPARE[0:11] connect to fan_ctrl_rmon card connector(now not connected)
+W6,GPIOO4_TACH4_VPIR2,BI,RCKMON_SPARE8,RCKMON_SPARE[0:11] connect to fan_ctrl_rmon card connector(now not connected)
+AA5,GPIOO5_TACH5_VPIR3,BI,RCKMON_SPARE9,RCKMON_SPARE[0:11] connect to fan_ctrl_rmon card connector(now not connected)
+AB4,GPIOO6_TACH6_VPIR4,BI,RCKMON_SPARE6,RCKMON_SPARE[0:11] connect to fan_ctrl_rmon card connector(now not connected)
+V7,GPIOO7_TACH7_VPIR5,BI,RCKMON_SPARE7,RCKMON_SPARE[0:11] connect to fan_ctrl_rmon card connector(now not connected)
+Y6,GPIOP0_TACH8_VPIR6,In,RMON1_PF,"rack 1 monitor status, Power Failure, active low"
+AB5,GPIOP1_TACH9_VPIR7,In,RMON1_RF,"rack 1 monitor status, redudancy Failure, active low"
+W7,GPIOP2_TACH10_VPIR8,In,RMON2_PF,"rack 2 monitor status, Power Failure, active low"
+AA6,GPIOP3_TACH11_VPIR9,In,RMON2_RF,"rack 2 monitor status, redudancy Failure, active low"
+AB6,GPIOP4_TACH12,In,RMON3_PF,"rack 3 monitor status, Power Failure, active low"
+Y7,GPIOP5_TACH13,In,RMON3_RF,"rack 3 monitor status, redudancy Failure, active low"
+AA7,GPIOP6_TACH14_BMCINT,In,FANCARD_I2C_ALARM,"fan card alarm input, active low"
+AB7,GPIOP7_TACH15_FLACK,out,BMC_READY_N,"0: BMC is ready for service. 1: BMC is not ready, or during initialization"
+H4,GPIOQ4_SCL14,In,BMC_CPLD_POWER_INT,Intrerrupt from CPLD to BMC for any Power events
+H3,GPIOQ5_SDA14,,BMC_CPLD_SPARE7,Spare GPIOs to CPLD
+H2,GPIOQ6,out,USB_OCS_N1,over-current sense output to USB2513 hub
+H1,GPIOQ7,out,BMC_HEARTBEAT_N,BMC heatbeat output to onboard heartbeat LED
+C6,GPIOR6_MDC1,BI,SWITCH_MDC,MDC/MDIO to GE Switch
+A5,GPIOR7_MDIO1,BI,SWITCH_MDIO,
+V20,GPIOR0_ROMCS1_N,out,SPI_IBMC_BT_CS1_N_R,chip select to secondary boot SPI flash
+U21,ROMD4_GPIOS0_VPODE,Out,BMC_SPI_WP_N,Write protect for Secondary Boot Flash. Connected to CPLD. CPLD will drive it to the flash chip
+C21,GPIOY0_SIOS3_N,In,BOARD_REV_ID0,"Board ID input bit0, resister straping, connect to both BMC and CPLD"
+F20,GPIOY1_SIOS5_N,In,BOARD_REV_ID1,"Board ID input bit1, resister straping, connect to both BMC and CPLD"
+G20,GPIOY2_SIOPWREQ_N,In,BOARD_REV_ID2,"Board ID input bit2, resister straping, connect to both BMC and CPLD"
diff --git a/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/openbmc_gpio_setup.py b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/openbmc_gpio_setup.py
new file mode 100644
index 0000000..dd14763
--- /dev/null
+++ b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/openbmc_gpio_setup.py
@@ -0,0 +1,75 @@
+#!/usr/bin/python -tt
+# Copyright 2015-present Facebook. All rights reserved.
+#
+# This program file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program in a file named COPYING; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301 USA
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+from board_gpio_rev_table import board_gpio_rev_table
+from board_gpio_table_v1 import board_gpio_table_v1
+from board_gpio_table_v2 import board_gpio_table_v2
+from soc_gpio_table import soc_gpio_table
+from openbmc_gpio_table import setup_board_gpio
+from soc_gpio import soc_get_register
+
+import openbmc_gpio
+import sys
+
+def set_register():
+ '''
+ For DVT/EVT boards the framework is not able to handle for GPIOS0 and
+ causes error : 'Failed to configure "GPIOS0" for "BMC_SPI_WP_N":
+ Not able to unsatisfy an AND condition'. In order to fix the error
+ set the specific bit in the register so the framework can handle it.
+ '''
+ l_reg = soc_get_register(0x8C)
+ l_reg.clear_bit(0, write_through=True)
+
+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('BOARD_REV_ID0')
+ v1 = openbmc_gpio.gpio_get('BOARD_REV_ID1')
+ v2 = openbmc_gpio.gpio_get('BOARD_REV_ID2')
+ return ((v2 << 2) | (v1 << 1) | v0)
+
+def main():
+ print('Setting up GPIOs ... ', end='')
+ sys.stdout.flush()
+ openbmc_gpio.setup_shadow()
+ version = wedge_board_rev(soc_gpio_table,board_gpio_rev_table)
+ # In order to satisy/unsatisfy conditions in setup_board_gpio()
+ # modify the registers
+ set_register()
+ if version is 1:
+ print('Using GPIO EVT table ', end='')
+ setup_board_gpio(soc_gpio_table, board_gpio_table_v1)
+ else:
+ if version is 2:
+ print('Using GPIO DVT table ', end='')
+ else:
+ print('Unexpected board version %s. Using GPIO DVT table. '
+ % version, end='')
+ setup_board_gpio(soc_gpio_table, board_gpio_table_v2)
+ print('Done')
+ sys.stdout.flush()
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/setup_board.py b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/setup_board.py
new file mode 100644
index 0000000..bb6ccb1
--- /dev/null
+++ b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/setup_board.py
@@ -0,0 +1,22 @@
+# Copyright 2015-present Facebook. All rights reserved.
+#
+# This program file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program in a file named COPYING; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301 USA
+
+board_py_modules=[
+ 'board_gpio_table_v1',
+ 'board_gpio_table_v2',
+ 'board_gpio_rev_table',
+]
diff --git a/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/wedge100_gpio_parse.py b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/wedge100_gpio_parse.py
new file mode 100644
index 0000000..b53f9de
--- /dev/null
+++ b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/files/wedge100_gpio_parse.py
@@ -0,0 +1,102 @@
+#!/usr/bin/python -tt
+# Copyright 2015-present Facebook. All Rights Reserved.
+#
+# This program file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program in a file named COPYING; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301 USA
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+import argparse
+import csv
+import logging
+import re
+import sys
+
+
+GPIO_SYMBOL = 'BoardGPIO'
+
+
+class CsvReader:
+ '''
+ A class for parsing the CSV files containing the board GPIO config
+ '''
+ def __init__(self, path):
+ self.path = path
+
+ fileobj = open(path, 'r')
+ self.reader = csv.reader(fileobj, delimiter=b',', quotechar=b'"')
+
+ def next(self):
+ try:
+ line = self.reader.next()
+ except StopIteration:
+ return None
+ return line
+
+
+class WedgeGPIO(object):
+ def __init__(self, data):
+ self.data = data
+ self.gpios = {}
+ self.names = set()
+
+ def parse(self):
+ while True:
+ line = self.data.next()
+ if line is None:
+ break
+
+ logging.debug('Parsing line: %s' % line)
+
+ if len(line) < 4:
+ logging.error('No enough fields in "%s". Skip!' % line)
+ continue
+
+ gpio = None
+ for part in line[1].split('_'):
+ if part.startswith('GPIO'):
+ gpio = part
+ break
+ if gpio is None:
+ logging.error('Cannot find GPIO file from "%s". Skip!' % line)
+ continue
+
+ name = line[3]
+ assert gpio not in self.gpios and name not in self.names
+ self.gpios[gpio] = name
+ self.names.add(name)
+
+ def print(self, out):
+ for gpio in sorted(self.gpios):
+ out.write(' %s(\'%s\', \'%s\'),\n'
+ % (GPIO_SYMBOL, gpio, self.gpios[gpio]))
+
+
+def main():
+ ap = argparse.ArgumentParser()
+ ap.add_argument('data', help='The GPIO data file')
+ args = ap.parse_args()
+
+ logging.basicConfig(level=logging.INFO, format='%(asctime)s: %(message)s')
+
+ gpio = WedgeGPIO(CsvReader(args.data))
+ gpio.parse()
+ gpio.print(sys.stdout)
+
+
+rc = main()
+sys.exit(rc)
diff --git a/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/openbmc-gpio_%.bbappend b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/openbmc-gpio_%.bbappend
new file mode 100644
index 0000000..afc133a
--- /dev/null
+++ b/meta-facebook/meta-wedge100/recipes-utils/openbmc-gpio/openbmc-gpio_%.bbappend
@@ -0,0 +1,36 @@
+# Copyright 2014-present Facebook. All Rights Reserved.
+#
+# This program file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program in a file named COPYING; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301 USA
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += " \
+ file://board_gpio_table_v1.py \
+ file://board_gpio_table_v2.py \
+ file://board_gpio_rev_table.py \
+ file://openbmc_gpio_setup.py \
+ file://setup_board.py \
+ "
+OPENBMC_GPIO_SOC_TABLE = "ast2400_gpio_table.py"
+
+do_install_append() {
+ install -d ${D}${sysconfdir}/init.d
+ install -d ${D}${sysconfdir}/rcS.d
+ install -m 755 openbmc_gpio_setup.py ${D}${sysconfdir}/init.d/openbmc_gpio_setup.py
+ update-rc.d -r ${D} openbmc_gpio_setup.py start 59 S .
+}
+
+FILES_${PN} += "/usr/local/bin ${sysconfdir}"
OpenPOWER on IntegriCloud