diff options
author | Tian Fang <tfang@fb.com> | 2015-12-14 22:08:40 -0800 |
---|---|---|
committer | Tian Fang <tfang@fb.com> | 2015-12-15 09:49:21 -0800 |
commit | e65a7944211c70f6b5cfb6cedd73cc31105319de (patch) | |
tree | 067082251bc52bc6c09ca87feaa1352d0468a5ac /meta-aspeed/recipes-utils | |
parent | 8a67fbdd0e251bb34d55992b0771edba1837d589 (diff) | |
download | ast2050-yocto-openbmc-e65a7944211c70f6b5cfb6cedd73cc31105319de.zip ast2050-yocto-openbmc-e65a7944211c70f6b5cfb6cedd73cc31105319de.tar.gz |
Sync to internal OpenBMC repo f926614
Diffstat (limited to 'meta-aspeed/recipes-utils')
8 files changed, 1902 insertions, 0 deletions
diff --git a/meta-aspeed/recipes-utils/openbmc-gpio/files/ast2400_gpio_table.py b/meta-aspeed/recipes-utils/openbmc-gpio/files/ast2400_gpio_table.py new file mode 100644 index 0000000..68d4203 --- /dev/null +++ b/meta-aspeed/recipes-utils/openbmc-gpio/files/ast2400_gpio_table.py @@ -0,0 +1,1022 @@ +# 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 ( + BitsEqual, BitsNotEqual, And, Or, Function) + + +# The fallowing table is generated using: +# python ast_gpio_parser.py data/ast2400-gpio.csv +# DO NOT MODIFY THE TABLE!!! +# Manual modification will be overridden!!! + +soc_gpio_table = { + 'A1': [ + Function('SD1WP#', BitsEqual(0x90, [0], 0x1)), + Function('SDA13', BitsEqual(0x90, [26], 0x1)), + Function('GPIOC7', None) + ], + 'A10': [ + Function('GPIOU0', BitsEqual(0xa0, [8], 0x1)), + Function('RMII2TXD0', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2TXD0', None) + ], + 'A11': [ + Function('GPIOV0', BitsEqual(0xa0, [16], 0x1)), + Function('RMII1CRSDV', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1RXD2', None) + ], + 'A12': [ + Function('GPIOT0', BitsEqual(0xa0, [0], 0x1)), + Function('RMII1TXEN', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1TXCK', None) + ], + 'A13': [ + Function('GPIOT5', BitsEqual(0xa0, [5], 0x1)), + Function('UNDEFINED5', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1TXD3', None) + ], + 'A14': [ + Function('SGPSCK', BitsEqual(0x84, [0], 0x1)), + Function('GPIOG0', None) + ], + 'A15': [ + Function('NRI3', BitsEqual(0x80, [19], 0x1)), + Function('GPIE2(Out)', Or(BitsEqual(0x8c, [13], 0x1), BitsEqual(0x70, [22], 0x1))), + Function('GPIOE3', None) + ], + 'A16': [ + Function('SD2CD#', BitsEqual(0x90, [1], 0x1)), + Function('GPID6(In)', Or(BitsEqual(0x8c, [11], 0x1), BitsEqual(0x70, [21], 0x1))), + Function('GPIOD6', None) + ], + 'A17': [ + Function('SD2DAT1', BitsEqual(0x90, [1], 0x1)), + Function('GPID2(Out)', Or(BitsEqual(0x8c, [9], 0x1), BitsEqual(0x70, [21], 0x1))), + Function('GPIOD3', None) + ], + 'A18': [ + Function('SD2CLK', BitsEqual(0x90, [1], 0x1)), + Function('GPID0(In)', Or(BitsEqual(0x8c, [8], 0x1), BitsEqual(0x70, [21], 0x1))), + Function('GPIOD0', None) + ], + 'A19': [ + Function('NRTS4', BitsEqual(0x80, [29], 0x1)), + Function('SIOSCI#', Or(BitsEqual(0xa4, [15], 0x1), BitsEqual(0x70, [19], 0x0))), + Function('GPIOF5', None) + ], + 'A2': [ + Function('SD1DAT0', BitsEqual(0x90, [0], 0x1)), + Function('SCL11', BitsEqual(0x90, [24], 0x1)), + Function('GPIOC2', None) + ], + 'A20': [ + Function('NDSR4', BitsEqual(0x80, [26], 0x1)), + Function('SIOPWRGD', Or(BitsEqual(0xa4, [13], 0x1), BitsEqual(0x70, [19], 0x0))), + Function('GPIOF2', None) + ], + 'A3': [ + Function('MDC2', BitsEqual(0x90, [2], 0x1)), + Function('TIMER7', BitsEqual(0x80, [6], 0x1)), + Function('GPIOA6', None) + ], + 'A4': [ + Function('TIMER3', BitsEqual(0x80, [2], 0x1)), + Function('GPIOA2', None) + ], + 'A5': [ + Function('MDIO1', BitsEqual(0x88, [31], 0x1)), + Function('GPIOR7', None) + ], + 'A6': [ + Function('ROMD14', Or(BitsEqual(0x90, [6], 0x1), BitsEqual(0x70, [4, 1, 0], 0x4))), + Function('TXD6', BitsEqual(0x90, [7], 0x1)), + Function('GPIOH6', None) + ], + 'A7': [ + Function('ROMD11', Or(BitsEqual(0x90, [6], 0x1), BitsEqual(0x70, [4, 1, 0], 0x4))), + Function('NRI6', BitsEqual(0x90, [7], 0x1)), + Function('GPIOH3', None) + ], + 'A8': [ + Function('ROMD8', Or(BitsEqual(0x90, [6], 0x1), BitsEqual(0x70, [4, 1, 0], 0x4))), + Function('NCTS6', BitsEqual(0x90, [7], 0x1)), + Function('GPIOH0', None) + ], + 'A9': [ + Function('GPIOV4', BitsEqual(0xa0, [20], 0x1)), + Function('RMII2RXD0', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2RXD0', None) + ], + 'AA1': [ + Function('VPIB8', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [30], 0x1))), + Function('TXD2', BitsEqual(0x84, [30], 0x1)), + Function('GPIOM6', None) + ], + 'AA2': [ + Function('VPIG2', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x88, [2], 0x1))), + Function('PWM2', BitsEqual(0x88, [2], 0x1)), + Function('GPION2', None) + ], + 'AA22': [ + Function('FLBUSY#', BitsEqual(0x84, [6], 0x1)), + Function('GPIOG6', None) + ], + 'AA3': [ + Function('VPIG6', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [6], 0x1))), + Function('PWM6', BitsEqual(0x88, [6], 0x1)), + Function('GPION6', None) + ], + 'AA4': [ + Function('VPIR0', And(BitsEqual(0x90, [5, 4], 0x3), BitsEqual(0x88, [10], 0x1))), + Function('GPIOO2/TACH2', None) + ], + 'AA5': [ + Function('VPIR3', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [13], 0x1))), + Function('GPIOO5/TACH5', None) + ], + 'AA6': [ + Function('VPIR9', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [19], 0x1))), + Function('GPIOP3/TACH11', None) + ], + 'AA7': [ + Function('BMCINT', BitsEqual(0x88, [22], 0x1)), + Function('GPIOP6/TACH14', None) + ], + 'AB1': [ + Function('VPIG3', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x88, [3], 0x1))), + Function('PWM3', BitsEqual(0x88, [3], 0x1)), + Function('GPION3', None) + ], + 'AB2': [ + Function('VPIG7', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [7], 0x1))), + Function('PWM7', BitsEqual(0x88, [7], 0x1)), + Function('GPION7', None) + ], + 'AB20': [ + Function('USB2_HDN', BitsEqual(0x90, [29], 0x1)), + Function('USB2_DN', None) + ], + 'AB21': [ + Function('USB2_HDP', BitsEqual(0x90, [29], 0x1)), + Function('USB2_DP', None) + ], + 'AB3': [ + Function('VPIR1', And(BitsEqual(0x90, [5, 4], 0x3), BitsEqual(0x88, [11], 0x1))), + Function('GPIOO3/TACH3', None) + ], + 'AB4': [ + Function('VPIR4', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [14], 0x1))), + Function('GPIOO6/TACH6', None) + ], + 'AB5': [ + Function('VPIR7', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [17], 0x1))), + Function('GPIOP1/TACH9', None) + ], + 'AB7': [ + Function('FLACK', BitsEqual(0x88, [23], 0x1)), + Function('GPIOP7/TACH15', None) + ], + 'B1': [ + Function('SCL4', BitsEqual(0x90, [17], 0x1)), + Function('GPIOQ2', None) + ], + 'B10': [ + Function('GPIOU1', BitsEqual(0xa0, [9], 0x1)), + Function('RMII2TXD1', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2TXD1', None) + ], + 'B11': [ + Function('GPIOU7', BitsEqual(0xa0, [15], 0x1)), + Function('RMII1RXD1', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1RXD1', None) + ], + 'B12': [ + Function('GPIOT1', BitsEqual(0xa0, [1], 0x1)), + Function('UNDEFINED3', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1TXCTL', None) + ], + 'B13': [ + Function('OSCCLK', BitsEqual(0x2c, [1], 0x1)), + Function('WDTRST1', BitsEqual(0x84, [4], 0x1)), + Function('GPIOG4', None) + ], + 'B14': [ + Function('RXD3', BitsEqual(0x80, [23], 0x1)), + Function('GPIE6(Out)', Or(BitsEqual(0x8c, [15], 0x1), BitsEqual(0x70, [22], 0x1))), + Function('GPIOE7', None) + ], + 'B15': [ + Function('NDSR3', BitsEqual(0x80, [18], 0x1)), + Function('GPIE2(In)', Or(BitsEqual(0x8c, [13], 0x1), BitsEqual(0x70, [22], 0x1))), + Function('GPIOE2', None) + ], + 'B16': [ + Function('SD2DAT3', BitsEqual(0x90, [1], 0x1)), + Function('GPID4(Out)', Or(BitsEqual(0x8c, [10], 0x1), BitsEqual(0x70, [21], 0x1))), + Function('GPIOD5', None) + ], + 'B17': [ + Function('SD2DAT0', BitsEqual(0x90, [1], 0x1)), + Function('GPID2(In)', Or(BitsEqual(0x8c, [9], 0x1), BitsEqual(0x70, [21], 0x1))), + Function('GPIOD2', None) + ], + 'B18': [ + Function('NDTR4', BitsEqual(0x80, [28], 0x1)), + Function('GPIOF4', None) + ], + 'B19': [ + Function('NDCD4', BitsEqual(0x80, [25], 0x1)), + Function('SIOPBI#', Or(BitsEqual(0xa4, [12], 0x1), BitsEqual(0x70, [19], 0x0))), + Function('GPIOF1', None) + ], + 'B2': [ + Function('SD1CD#', BitsEqual(0x90, [0], 0x1)), + Function('SCL13', BitsEqual(0x90, [26], 0x1)), + Function('GPIOC6', None) + ], + 'B22': [ + Function('SPICS0#', BitsNotEqual(0x70, [13, 12], 0x0)), + Function('VBCS#', BitsEqual(0x70, [5], 0x1)), + Function('GPIOI4', None) + ], + 'B3': [ + Function('SD1CMD', BitsEqual(0x90, [0], 0x1)), + Function('SDA10', BitsEqual(0x90, [23], 0x1)), + Function('GPIOC1', None) + ], + 'B4': [ + Function('SDA9', BitsEqual(0x90, [22], 0x1)), + Function('TIMER6', BitsEqual(0x80, [5], 0x1)), + Function('GPIOA5', None) + ], + 'B5': [ + Function('MAC2LINK', BitsEqual(0x80, [1], 0x1)), + Function('GPIOA1', None) + ], + 'B6': [ + Function('ROMD13', Or(BitsEqual(0x90, [6], 0x1), BitsEqual(0x70, [4, 1, 0], 0x4))), + Function('NRTS6', BitsEqual(0x90, [7], 0x1)), + Function('GPIOH5', None) + ], + 'B7': [ + Function('ROMD10', Or(BitsEqual(0x90, [6], 0x1), BitsEqual(0x70, [4, 1, 0], 0x4))), + Function('NDSR6', BitsEqual(0x90, [7], 0x1)), + Function('GPIOH2', None) + ], + 'B9': [ + Function('GPIOV3', BitsEqual(0xa0, [19], 0x1)), + Function('UNDEFINED10', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2RXCTL', None) + ], + 'C1': [ + Function('SCL6', BitsEqual(0x90, [19], 0x1)), + Function('GPIOK2', None) + ], + 'C10': [ + Function('GPIOU2', BitsEqual(0xa0, [10], 0x1)), + Function('UNDEFINED7', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2TXD2', None) + ], + 'C11': [ + Function('GPIOU6', BitsEqual(0xa0, [14], 0x1)), + Function('RMII1RXD0', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1RXD0', None) + ], + 'C12': [ + Function('GPIOT2', BitsEqual(0xa0, [2], 0x1)), + Function('RMII1TXD0', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1TXD0', None) + ], + 'C13': [ + Function('SGPSI1', BitsEqual(0x84, [3], 0x1)), + Function('GPIOG3', None) + ], + 'C14': [ + Function('TXD3', BitsEqual(0x80, [22], 0x1)), + Function('GPIE6(In)', Or(BitsEqual(0x8c, [15], 0x1), BitsEqual(0x70, [22], 0x1))), + Function('GPIOE6', None) + ], + 'C15': [ + Function('NDCD3', BitsEqual(0x80, [17], 0x1)), + Function('GPIE0(Out)', Or(BitsEqual(0x8c, [12], 0x1), BitsEqual(0x70, [22], 0x1))), + Function('GPIOE1', None) + ], + 'C16': [ + Function('SD2DAT2', BitsEqual(0x90, [1], 0x1)), + Function('GPID4(In)', Or(BitsEqual(0x8c, [10], 0x1), BitsEqual(0x70, [21], 0x1))), + Function('GPIOD4', None) + ], + 'C17': [ + Function('RXD4', BitsEqual(0x80, [31], 0x1)), + Function('GPIOF7', None) + ], + 'C18': [ + Function('SPIDO', BitsNotEqual(0x70, [13, 12], 0x0)), + Function('VBDO', BitsEqual(0x70, [5], 0x1)), + Function('GPIOI6', None) + ], + 'C2': [ + Function('SDA3', BitsEqual(0x90, [16], 0x1)), + Function('GPIOQ1', None) + ], + 'C20': [ + Function('SYSDI', BitsEqual(0x70, [13], 0x1)), + Function('GPIOI3', None) + ], + 'C21': [ + Function('SIOS3#', Or(BitsEqual(0xa4, [8], 0x1), BitsEqual(0x70, [19], 0x0))), + Function('GPIOY0', None) + ], + 'C22': [ + Function('SYSCS#', BitsEqual(0x70, [13], 0x1)), + Function('GPIOI0', None) + ], + 'C3': [ + Function('SD1DAT3', BitsEqual(0x90, [0], 0x1)), + Function('SDA12', BitsEqual(0x90, [25], 0x1)), + Function('GPIOC5', None) + ], + 'C4': [ + Function('SD1CLK', BitsEqual(0x90, [0], 0x1)), + Function('SCL10', BitsEqual(0x90, [23], 0x1)), + Function('GPIOC0', None) + ], + 'C5': [ + Function('SCL9', BitsEqual(0x90, [22], 0x1)), + Function('TIMER5', BitsEqual(0x80, [4], 0x1)), + Function('GPIOA4', None) + ], + 'C6': [ + Function('MDC1', BitsEqual(0x88, [30], 0x1)), + Function('GPIOR6', None) + ], + 'C7': [ + Function('ROMD9', Or(BitsEqual(0x90, [6], 0x1), BitsEqual(0x70, [4, 1, 0], 0x4))), + Function('NDCD6', BitsEqual(0x90, [7], 0x1)), + Function('GPIOH1', None) + ], + 'C8': [ + Function('GPIOV7', BitsEqual(0xa0, [23], 0x1)), + Function('RMII2RXER', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2RXD3', None) + ], + 'C9': [ + Function('GPIOV2', BitsEqual(0xa0, [18], 0x1)), + Function('RMII2RCLK', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2RXCK', None) + ], + 'D1': [ + Function('SDA7', BitsEqual(0x90, [20], 0x1)), + Function('GPIOK5', None) + ], + 'D10': [ + Function('GPIOU3', BitsEqual(0xa0, [11], 0x1)), + Function('UNDEFINED8', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2TXD3', None) + ], + 'D11': [ + Function('GPIOU5', BitsEqual(0xa0, [13], 0x1)), + Function('UNDEFINED9', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1RXCTL', None) + ], + 'D12': [ + Function('GPIOT3', BitsEqual(0xa0, [3], 0x1)), + Function('RMII1TXD1', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1TXD1', None) + ], + 'D13': [ + Function('SGPSI0', BitsEqual(0x84, [2], 0x1)), + Function('GPIOG2', None) + ], + 'D14': [ + Function('NRTS3', BitsEqual(0x80, [21], 0x1)), + Function('GPIE4(Out)', Or(BitsEqual(0x8c, [14], 0x1), BitsEqual(0x70, [22], 0x1))), + Function('GPIOE5', None) + ], + 'D15': [ + Function('NCTS3', BitsEqual(0x80, [16], 0x1)), + Function('GPIE0(In)', Or(BitsEqual(0x8c, [12], 0x1), BitsEqual(0x70, [22], 0x1))), + Function('GPIOE0', None) + ], + 'D16': [ + Function('SD2CMD', BitsEqual(0x90, [1], 0x1)), + Function('GPID0(Out)', Or(BitsEqual(0x8c, [8], 0x1), BitsEqual(0x70, [21], 0x1))), + Function('GPIOD1', None) + ], + 'D17': [ + Function('NRI4', BitsEqual(0x80, [27], 0x1)), + Function('SIOPBO#', Or(BitsEqual(0xa4, [14], 0x1), BitsEqual(0x70, [19], 0x0))), + Function('GPIOF3', None) + ], + 'D18': [ + Function('NCTS4', BitsEqual(0x80, [24], 0x1)), + Function('GPIOF0', None) + ], + 'D19': [ + Function('SYSDO', BitsEqual(0x70, [13], 0x1)), + Function('GPIOI2', None) + ], + 'D2': [ + Function('SDA5', BitsEqual(0x90, [18], 0x1)), + Function('GPIOK1', None) + ], + 'D3': [ + Function('SCL3', BitsEqual(0x90, [16], 0x1)), + Function('GPIOQ0', None) + ], + 'D4': [ + Function('SD1DAT2', BitsEqual(0x90, [0], 0x1)), + Function('SCL12', BitsEqual(0x90, [25], 0x1)), + Function('GPIOC4', None) + ], + 'D5': [ + Function('MDIO2', BitsEqual(0x90, [2], 0x1)), + Function('TIMER8', BitsEqual(0x80, [7], 0x1)), + Function('GPIOA7', None) + ], + 'D6': [ + Function('MAC1LINK', BitsEqual(0x80, [0], 0x1)), + Function('GPIOA0', None) + ], + 'D7': [ + Function('ROMD12', Or(BitsEqual(0x90, [6], 0x1), BitsEqual(0x70, [4, 1, 0], 0x4))), + Function('NDTR6', BitsEqual(0x90, [7], 0x1)), + Function('GPIOH4', None) + ], + 'D8': [ + Function('GPIOV6', BitsEqual(0xa0, [22], 0x1)), + Function('RMII2CRSDV', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2RXD2', None) + ], + 'D9': [ + Function('GPIOT6', BitsEqual(0xa0, [6], 0x1)), + Function('RMII2TXEN', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2TXCK', None) + ], + 'E10': [ + Function('GPIOV1', BitsEqual(0xa0, [17], 0x1)), + Function('RMII1RXER', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1RXD3', None) + ], + 'E11': [ + Function('GPIOU4', BitsEqual(0xa0, [12], 0x1)), + Function('RMII1RCLK', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1RXCK', None) + ], + 'E12': [ + Function('GPIOT4', BitsEqual(0xa0, [4], 0x1)), + Function('UNDEFINED4', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1TXD2', None) + ], + 'E13': [ + Function('SGPSLD', BitsEqual(0x84, [1], 0x1)), + Function('GPIOG1', None) + ], + 'E14': [ + Function('NDTR3', BitsEqual(0x80, [20], 0x1)), + Function('GPIE4(In)', Or(BitsEqual(0x8c, [14], 0x1), BitsEqual(0x70, [22], 0x1))), + Function('GPIOE4', None) + ], + 'E15': [ + Function('SD2WP#', BitsEqual(0x90, [1], 0x1)), + Function('GPID6(Out)', Or(BitsEqual(0x8c, [11], 0x1), BitsEqual(0x70, [21], 0x1))), + Function('GPIOD7', None) + ], + 'E16': [ + Function('TXD4', BitsEqual(0x80, [30], 0x1)), + Function('GPIOF6', None) + ], + 'E18': [ + Function('EXTRST#', And(BitsEqual(0x80, [15], 0x1), And(BitsEqual(0x90, [31], 0x0), BitsEqual(0x3c, [3], 0x1)))), + Function('SPICS1#', And(BitsEqual(0x80, [15], 0x1), BitsEqual(0x90, [31], 0x1))), + Function('GPIOB7', None) + ], + 'E19': [ + Function('LPCRST#', Or(BitsEqual(0x80, [12], 0x1), BitsEqual(0x70, [14], 0x1))), + Function('GPIOB4', None) + ], + 'E2': [ + Function('SCL7', BitsEqual(0x90, [20], 0x1)), + Function('GPIOK4', None) + ], + 'E20': [ + Function('SPIDI', BitsNotEqual(0x70, [13, 12], 0x0)), + Function('VBDI', BitsEqual(0x70, [5], 0x1)), + Function('GPIOI7', None) + ], + 'E3': [ + Function('SCL5', BitsEqual(0x90, [18], 0x1)), + Function('GPIOK0', None) + ], + 'E5': [ + Function('SD1DAT1', BitsEqual(0x90, [0], 0x1)), + Function('SDA11', BitsEqual(0x90, [24], 0x1)), + Function('GPIOC3', None) + ], + 'E6': [ + Function('TIMER4', BitsEqual(0x80, [3], 0x1)), + Function('GPIOA3', None) + ], + 'E7': [ + Function('ROMD15', Or(BitsEqual(0x90, [6], 0x1), BitsEqual(0x70, [4, 1, 0], 0x4))), + Function('RXD6', BitsEqual(0x90, [7], 0x1)), + Function('GPIOH7', None) + ], + 'E8': [ + Function('GPIOV5', BitsEqual(0xa0, [21], 0x1)), + Function('RMII2RXD1', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2RXD1', None) + ], + 'E9': [ + Function('GPIOT7', BitsEqual(0xa0, [7], 0x1)), + Function('UNDEFINED6', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2TXCTL', None) + ], + 'F18': [ + Function('SALT4', BitsEqual(0x80, [11], 0x1)), + Function('GPIOB3', None) + ], + 'F20': [ + Function('SIOS5#', Or(BitsEqual(0xa4, [9], 0x1), BitsEqual(0x70, [19], 0x0))), + Function('GPIOY1', None) + ], + 'F3': [ + Function('SDA8', BitsEqual(0x90, [21], 0x1)), + Function('GPIOK7', None) + ], + 'F4': [ + Function('SDA6', BitsEqual(0x90, [19], 0x1)), + Function('GPIOK3', None) + ], + 'F5': [ + Function('SDA4', BitsEqual(0x90, [17], 0x1)), + Function('GPIOQ3', None) + ], + 'G18': [ + Function('SYSCK', BitsEqual(0x70, [13], 0x1)), + Function('GPIOI1', None) + ], + 'G19': [ + Function('SPICK', BitsNotEqual(0x70, [13, 12], 0x0)), + Function('VBCK', BitsEqual(0x70, [5], 0x1)), + Function('GPIOI5', None) + ], + 'G20': [ + Function('SIOPWREQ#', Or(BitsEqual(0xa4, [10], 0x1), BitsEqual(0x70, [19], 0x0))), + Function('GPIOY2', None) + ], + 'G5': [ + Function('SCL8', BitsEqual(0x90, [21], 0x1)), + Function('GPIOK6', None) + ], + 'H1': [ + Function('UNDEFINED2', BitsEqual(0x90, [28], 0x1)), + Function('GPIOQ7', None) + ], + 'H18': [ + Function('SALT3', BitsEqual(0x80, [10], 0x1)), + Function('GPIOB2', None) + ], + 'H2': [ + Function('UNDEFINED1', BitsEqual(0x90, [28], 0x1)), + Function('GPIOQ6', None) + ], + 'H20': [ + Function('LPCPME#', BitsEqual(0x80, [14], 0x1)), + Function('GPIOB6', None) + ], + 'H3': [ + Function('SDA14', BitsEqual(0x90, [27], 0x1)), + Function('GPIOQ5', None) + ], + 'H4': [ + Function('SCL14', BitsEqual(0x90, [27], 0x1)), + Function('GPIOQ4', None) + ], + 'J20': [ + Function('SALT2', BitsEqual(0x80, [9], 0x1)), + Function('GPIOB1', None) + ], + 'J21': [ + Function('SALT1', BitsEqual(0x80, [8], 0x1)), + Function('GPIOB0', None) + ], + 'J3': [ + Function('SGPMI', BitsEqual(0x84, [11], 0x1)), + Function('GPIOJ3', None) + ], + 'J4': [ + Function('SGPMLD', BitsEqual(0x84, [9], 0x1)), + Function('GPIOJ1', None) + ], + 'J5': [ + Function('SGPMCK', BitsEqual(0x84, [8], 0x1)), + Function('GPIOJ0', None) + ], + 'K18': [ + Function('ROMA23', And(BitsEqual(0x8c, [7], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOR5', And(BitsEqual(0x8c, [7], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOS7', None) + ], + 'K20': [ + Function('SIOONCTRL#', Or(BitsEqual(0xa4, [11], 0x1), BitsEqual(0x70, [19], 0x0))), + Function('GPIOY3', None) + ], + 'K3': [ + Function('UB11_HDN2', BitsEqual(0x90, [3], 0x1)), + Function('UB11_DN', None) + ], + 'K4': [ + Function('UB11_HDP2', BitsEqual(0x90, [3], 0x1)), + Function('UB11_DP', None) + ], + 'K5': [ + Function('SGPMO', BitsEqual(0x84, [10], 0x1)), + Function('GPIOJ2', None) + ], + 'L1': [ + Function('GPIW4', BitsEqual(0xa0, [28], 0x1)), + Function('ADC4', None) + ], + 'L18': [ + Function('ROMA10', And(BitsEqual(0xa4, [24], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOG0', And(BitsEqual(0xa4, [24], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOAA0', None) + ], + 'L19': [ + Function('ROMA11', And(BitsEqual(0xa4, [25], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOG1', And(BitsEqual(0xa4, [25], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOAA1', None) + ], + 'L2': [ + Function('GPIW3', BitsEqual(0xa0, [27], 0x1)), + Function('ADC3', None) + ], + 'L20': [ + Function('ROMA12', And(BitsEqual(0xa4, [26], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOG2', And(BitsEqual(0xa4, [26], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOAA2', None) + ], + 'L21': [ + Function('ROMA13', And(BitsEqual(0xa4, [27], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOG3', And(BitsEqual(0xa4, [27], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOAA3', None) + ], + 'L22': [ + Function('ROMA22', And(BitsEqual(0x8c, [6], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOR4', And(BitsEqual(0x8c, [6], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOS6', None) + ], + 'L3': [ + Function('GPIW2', BitsEqual(0xa0, [26], 0x1)), + Function('ADC2', None) + ], + 'L4': [ + Function('GPIW1', BitsEqual(0xa0, [25], 0x1)), + Function('ADC1', None) + ], + 'L5': [ + Function('GPIW0', BitsEqual(0xa0, [24], 0x1)), + Function('ADC0', None) + ], + 'M1': [ + Function('GPIX1', BitsEqual(0xa4, [1], 0x1)), + Function('ADC9', None) + ], + 'M18': [ + Function('ROMA19', And(BitsEqual(0xa8, [1], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOR1', And(BitsEqual(0xa8, [1], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOAB1', None) + ], + 'M19': [ + Function('ROMA17', And(BitsEqual(0xa4, [31], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOG7', And(BitsEqual(0xa4, [31], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOAA7', None) + ], + 'M2': [ + Function('GPIX0', BitsEqual(0xa4, [0], 0x1)), + Function('ADC8', None) + ], + 'M20': [ + Function('ROMA18', And(BitsEqual(0xa8, [0], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOR0', And(BitsEqual(0xa8, [0], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOAB0', None) + ], + 'M21': [ + Function('ROMA8', And(BitsEqual(0xa4, [22], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOB6', And(BitsEqual(0xa4, [22], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOZ6', None) + ], + 'M22': [ + Function('ROMA9', And(BitsEqual(0xa4, [23], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOB7', And(BitsEqual(0xa4, [23], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOZ7', None) + ], + 'M3': [ + Function('GPIW7', BitsEqual(0xa0, [31], 0x1)), + Function('ADC7', None) + ], + 'M4': [ + Function('GPIW6', BitsEqual(0xa0, [30], 0x1)), + Function('ADC6', None) + ], + 'M5': [ + Function('GPIW5', BitsEqual(0xa0, [29], 0x1)), + Function('ADC5', None) + ], + 'N1': [ + Function('GPIX6', BitsEqual(0xa4, [6], 0x1)), + Function('ADC14', None) + ], + 'N18': [ + Function('ROMA15', And(BitsEqual(0xa4, [29], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOG5', And(BitsEqual(0xa4, [29], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOAA5', None) + ], + 'N19': [ + Function('ROMA16', And(BitsEqual(0xa4, [30], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOG6', And(BitsEqual(0xa4, [30], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOAA6', None) + ], + 'N2': [ + Function('GPIX5', BitsEqual(0xa4, [5], 0x1)), + Function('ADC13', None) + ], + 'N20': [ + Function('ROMA21', And(BitsEqual(0xa8, [3], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOR3', And(BitsEqual(0xa8, [3], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOAB3', None) + ], + 'N21': [ + Function('ROMWE#', BitsEqual(0x8c, [5], 0x1)), + Function('GPIOS5', None) + ], + 'N22': [ + Function('ROMA20', And(BitsEqual(0xa8, [2], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOR2', And(BitsEqual(0xa8, [2], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOAB2', None) + ], + 'N3': [ + Function('GPIX4', BitsEqual(0xa4, [4], 0x1)), + Function('ADC12', None) + ], + 'N4': [ + Function('GPIX3', BitsEqual(0xa4, [3], 0x1)), + Function('ADC11', None) + ], + 'N5': [ + Function('GPIX2', BitsEqual(0xa4, [2], 0x1)), + Function('ADC10', None) + ], + 'P18': [ + Function('ROMA3', And(BitsEqual(0xa4, [17], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOB1', And(BitsEqual(0xa4, [17], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOZ1', None) + ], + 'P19': [ + Function('ROMA4', And(BitsEqual(0xa4, [18], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOB2', And(BitsEqual(0xa4, [18], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOZ2', None) + ], + 'P20': [ + Function('ROMA5', And(BitsEqual(0xa4, [19], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOB3', And(BitsEqual(0xa4, [19], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOZ3', None) + ], + 'P21': [ + Function('ROMA6', And(BitsEqual(0xa4, [20], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOB4', And(BitsEqual(0xa4, [20], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOZ4', None) + ], + 'P22': [ + Function('ROMA7', And(BitsEqual(0xa4, [21], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOB5', And(BitsEqual(0xa4, [21], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOZ5', None) + ], + 'P5': [ + Function('GPIX7', BitsEqual(0xa4, [7], 0x1)), + Function('ADC15', None) + ], + 'R18': [ + Function('ROMOE#', BitsEqual(0x8c, [4], 0x1)), + Function('GPIOS4', None) + ], + 'R22': [ + Function('ROMA2', And(BitsEqual(0xa4, [16], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOB0', And(BitsEqual(0xa4, [16], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOZ0', None) + ], + 'T1': [ + Function('DDCDAT', BitsEqual(0x84, [15], 0x1)), + Function('GPIOJ7', None) + ], + 'T18': [ + Function('ROMA14', And(BitsEqual(0xa4, [28], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOG4', And(BitsEqual(0xa4, [28], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOAA4', None) + ], + 'T19': [ + Function('ROMD5', And(BitsEqual(0x8c, [1], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOHS', And(BitsEqual(0x8c, [1], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOS1', None) + ], + 'T2': [ + Function('DDCCLK', BitsEqual(0x84, [14], 0x1)), + Function('GPIOJ6', None) + ], + 'T4': [ + Function('VGAHS', BitsEqual(0x84, [12], 0x1)), + Function('GPIOJ4', None) + ], + 'T5': [ + Function('VPIDE', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [17], 0x1))), + Function('NDCD1', BitsEqual(0x84, [17], 0x1)), + Function('GPIOL1', None) + ], + 'U1': [ + Function('NCTS1', BitsEqual(0x84, [16], 0x1)), + Function('GPIOL0', None) + ], + 'U18': [ + Function('FLWP#', BitsEqual(0x84, [7], 0x1)), + Function('GPIOG7', None) + ], + 'U19': [ + Function('ROMCS4#', BitsEqual(0x88, [27], 0x1)), + Function('GPIOR3', None) + ], + 'U2': [ + Function('VGAVS', BitsEqual(0x84, [13], 0x1)), + Function('GPIOJ5', None) + ], + 'U20': [ + Function('ROMD7', And(BitsEqual(0x8c, [3], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOCLK', And(BitsEqual(0x8c, [3], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOS3', None) + ], + 'U21': [ + Function('ROMD4', And(BitsEqual(0x8c, [0], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPODE', And(BitsEqual(0x8c, [0], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOS0', None) + ], + 'U3': [ + Function('VPIODD', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [18], 0x1))), + Function('NDSR1', BitsEqual(0x84, [18], 0x1)), + Function('GPIOL2', None) + ], + 'U4': [ + Function('VPIVS', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [20], 0x1))), + Function('NDTR1', BitsEqual(0x84, [20], 0x1)), + Function('GPIOL4', None) + ], + 'U5': [ + Function('VPIB1', And(BitsEqual(0x90, [5, 4], 0x3), BitsEqual(0x84, [23], 0x1))), + Function('RXD1', BitsEqual(0x84, [23], 0x1)), + Function('GPIOL7', None) + ], + 'V1': [ + Function('VPIHS', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [19], 0x1))), + Function('NRI1', BitsEqual(0x84, [19], 0x1)), + Function('GPIOL3', None) + ], + 'V2': [ + Function('VPICLK', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [21], 0x1))), + Function('NRTS1', BitsEqual(0x84, [21], 0x1)), + Function('GPIOL5', None) + ], + 'V20': [ + Function('ROMCS1#', BitsEqual(0x88, [24], 0x1)), + Function('GPIOR0', None) + ], + 'V21': [ + Function('ROMA24', And(BitsEqual(0x88, [28], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOR6', And(BitsEqual(0x88, [28], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOR4', None) + ], + 'V22': [ + Function('ROMD6', And(BitsEqual(0x8c, [2], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOVS', And(BitsEqual(0x8c, [2], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOS2', None) + ], + 'V3': [ + Function('VPIB2', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [24], 0x1))), + Function('NCTS2', BitsEqual(0x84, [24], 0x1)), + Function('GPIOM0', None) + ], + 'V4': [ + Function('VPIB5', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [27], 0x1))), + Function('NRI2', BitsEqual(0x84, [27], 0x1)), + Function('GPIOM3', None) + ], + 'V5': [ + Function('VPIB9', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [31], 0x1))), + Function('RXD2', BitsEqual(0x84, [31], 0x1)), + Function('GPIOM7', None) + ], + 'V6': [ + Function('VPIG8', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [8], 0x1))), + Function('GPIOO0/TACH0', None) + ], + 'V7': [ + Function('VPIR5', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [15], 0x1))), + Function('GPIOO7/TACH7', None) + ], + 'W1': [ + Function('VPIB0', And(BitsEqual(0x90, [5, 4], 0x3), BitsEqual(0x84, [22], 0x1))), + Function('TXD1', BitsEqual(0x84, [22], 0x1)), + Function('GPIOL6', None) + ], + 'W2': [ + Function('VPIB3', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [25], 0x1))), + Function('NDCD2', BitsEqual(0x84, [25], 0x1)), + Function('GPIOM1', None) + ], + 'W21': [ + Function('ROMCS2#', BitsEqual(0x88, [25], 0x1)), + Function('GPIOR1', None) + ], + 'W22': [ + Function('ROMA25', And(BitsEqual(0x88, [29], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOR7', And(BitsEqual(0x88, [29], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOR5', None) + ], + 'W3': [ + Function('VPIB6', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [28], 0x1))), + Function('NDTR2', BitsEqual(0x84, [28], 0x1)), + Function('GPIOM4', None) + ], + 'W4': [ + Function('VPIG0', And(BitsEqual(0x90, [5, 4], 0x3), BitsEqual(0x88, [0], 0x1))), + Function('PWM0', BitsEqual(0x88, [0], 0x1)), + Function('GPION0', None) + ], + 'W5': [ + Function('VPIG4', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x88, [4], 0x1))), + Function('PWM4', BitsEqual(0x88, [4], 0x1)), + Function('GPION4', None) + ], + 'W6': [ + Function('VPIR2', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [12], 0x1))), + Function('GPIOO4/TACH4', None) + ], + 'W7': [ + Function('VPIR8', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [18], 0x1))), + Function('GPIOP2/TACH10', None) + ], + 'Y1': [ + Function('VPIB4', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [26], 0x1))), + Function('NDSR2', BitsEqual(0x84, [26], 0x1)), + Function('GPIOM2', None) + ], + 'Y2': [ + Function('VPIB7', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [29], 0x1))), + Function('NRTS2', BitsEqual(0x84, [29], 0x1)), + Function('GPIOM5', None) + ], + 'Y21': [ + Function('USBCKI', BitsEqual(0x70, [23], 0x1)), + Function('WDTRST2', BitsEqual(0x84, [5], 0x1)), + Function('GPIOG5', None) + ], + 'Y22': [ + Function('ROMCS3#', BitsEqual(0x88, [26], 0x1)), + Function('GPIOR2', None) + ], + 'Y3': [ + Function('VPIG1', And(BitsEqual(0x90, [5, 4], 0x3), BitsEqual(0x88, [1], 0x1))), + Function('PWM1', BitsEqual(0x88, [1], 0x1)), + Function('GPION1', None) + ], + 'Y4': [ + Function('VPIG5', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x88, [5], 0x1))), + Function('PWM5', BitsEqual(0x88, [5], 0x1)), + Function('GPION5', None) + ], + 'Y5': [ + Function('VPIG9', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [9], 0x1))), + Function('GPIOO1/TACH1', None) + ], + 'Y6': [ + Function('VPIR6', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [16], 0x1))), + Function('GPIOP0/TACH8', None) + ], +} diff --git a/meta-aspeed/recipes-utils/openbmc-gpio/files/ast_gpio_parser.py b/meta-aspeed/recipes-utils/openbmc-gpio/files/ast_gpio_parser.py new file mode 100644 index 0000000..acc4c1a --- /dev/null +++ b/meta-aspeed/recipes-utils/openbmc-gpio/files/ast_gpio_parser.py @@ -0,0 +1,204 @@ +#!/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 + +FUNC_SYMBOL = 'Function' +AND_SYMBOL = 'And' +OR_SYMBOL = 'Or' +BE_SYMBOL = 'BitsEqual' +BNE_SYMBOL = 'BitsNotEqual' + + +class CsvReader: + ''' + A class for parsing the CSV files containing the pin mapping data. + ''' + 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 Expression(object): + def __init__(self, exp): + self.exp = exp + + def parse(self): + # Strap[4,1:0]=100 + m = re.match('([^\[]+)\[(.+)\](!*=)([01]+)', self.exp) + # ('Strap', '4,1:0', '=', '100') + try: + if len(m.groups()) != 4: + raise + scuname = m.group(1) + if scuname.lower() == 'strap': + scu = 0x70 + elif scuname.startswith('SCU'): + scu = int(scuname[3:], 16) + + bits = [] + for bit in m.group(2).split(','): + if ':' in bit: + # it is a range + s, _, e = bit.partition(':') + ss = int(s) + ee = int(e) + if ss < ee: + assert 0 <= ss and ee <= 31 + bits += range(ss, ee + 1) + else: + assert 0 <= ee and ss <= 31 + bits += range(ee, ss + 1) + else: + bits += [int(bit)] + if m.group(3) == '!=': + cond = BNE_SYMBOL + else: + cond = BE_SYMBOL + value = int(m.group(4), 2) + return '%s(0x%x, %s, 0x%x)' \ + % (cond, scu, sorted(bits, reverse=True), value) + except Exception as e: + logging.exception('Failed to parse expression "%s"', self.exp) + + +class Conditions(object): + def __init__(self, cond): + self.cond = re.sub('\s+', '', cond) + + def _next_condition_pos(self, cur): + for idx in range(cur, len(self.cond)): + c = self.cond[idx] + if c == '&' or c == '|': + return idx + return -1 + + def _get_expression(self, exp): + if exp == '': + return None + return Expression(exp).parse() + + def _parse(self, idx): + next_idx = self._next_condition_pos(idx + 1) + if next_idx == -1: + # end of string + return self._get_expression(self.cond[idx:]) + + prev = self._get_expression(self.cond[idx:next_idx]) + if self.cond[next_idx] == '&': + cond = AND_SYMBOL + else: + cond = OR_SYMBOL + return '%s(%s, %s)' % (cond, prev, self._parse(next_idx + 1)) + + def parse(self): + return self._parse(0) + + +class AstGPIO(object): + def __init__(self, data): + self.data = data + self.undefined_func = 1 + self.pins = {} + self.functions = set() + + def _parse_conditions(self, cond): + return Conditions(cond).parse() + + def _parse_funcs(self, parts): + func_fmt = FUNC_SYMBOL + '(\'{func}\', {cond})' + if len(parts) < 1: + return [] + # Unable to process SIORD + if 'SIORD' in ' '.join(parts): + logging.warning('Unable to process SIORD. Ignore') + return [] + func = parts[0] + if func == '': + # nothing after + return [] + if func == '-': + func = 'UNDEFINED%d' % self.undefined_func + self.undefined_func += 1 + assert func not in self.functions + self.functions.add(func) + if len(parts) == 1: + # just has the function name, the last function + return [func_fmt.format(func=func, cond=None)] + cond = self._parse_conditions(parts[1]) + return [func_fmt.format(func=func, cond=cond)] \ + + self._parse_funcs(parts[2:]) + + def parse(self): + while True: + line = self.data.next() + if line is None: + break + + logging.debug('Parsing line: %s' % line) + + # V21,ROMA24,SCU88[28]=1 & SCU94[1]=0,VPOR6,SCU88[28]=1 & SCU94[1]=1,GPIOR4 + pin = line[0] + if pin == "": + # empty line + continue + funcs = self._parse_funcs(line[1:]) + logging.debug('%s: %s' % (pin, funcs)) + assert pin not in self.pins + self.pins[pin] = funcs + + def print(self, out): + for pin in sorted(self.pins): + if len(self.pins[pin]) == 0: + logging.warning('Pin "%s" has no function defined. Skip' % pin) + continue + out.write(' \'%s\': [\n %s\n ],\n' + % (pin, ',\n '.join(self.pins[pin]))) + + +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 = AstGPIO(CsvReader(args.data)) + gpio.parse() + gpio.print(sys.stdout) + + +rc = main() +sys.exit(rc) diff --git a/meta-aspeed/recipes-utils/openbmc-gpio/files/data/ast2400-gpio.csv b/meta-aspeed/recipes-utils/openbmc-gpio/files/data/ast2400-gpio.csv new file mode 100644 index 0000000..d41460e --- /dev/null +++ b/meta-aspeed/recipes-utils/openbmc-gpio/files/data/ast2400-gpio.csv @@ -0,0 +1,225 @@ +D6,MAC1LINK,SCU80[0]=1,GPIOA0,, +B5,MAC2LINK,SCU80[1]=1,GPIOA1,, +A4,TIMER3,SCU80[2]=1,GPIOA2,, +E6,TIMER4,SCU80[3]=1,GPIOA3,, +C5,SCL9,SCU90[22]=1,TIMER5,SCU80[4]=1,GPIOA4 +B4,SDA9,SCU90[22]=1,TIMER6,SCU80[5]=1,GPIOA5 +A3,MDC2,SCU90[2]=1,TIMER7,SCU80[6]=1,GPIOA6 +D5,MDIO2,SCU90[2]=1,TIMER8,SCU80[7]=1,GPIOA7 +J21,SALT1,SCU80[8]=1,GPIOB0,, +J20,SALT2,SCU80[9]=1,GPIOB1,, +H18,SALT3,SCU80[10]=1,GPIOB2,, +F18,SALT4,SCU80[11]=1,GPIOB3,, +E19,LPCRST#,SCU80[12]=1 | Strap[14]=1,GPIOB4,, +H19,LPCPD#,SCU80[13]=1 & SIORD30[1]=0,LPCSMI#,SCU80[13]=1 & SIORD30[1]=1,GPIOB5 +H20,LPCPME#,SCU80[14]=1,GPIOB6,, +E18,EXTRST#,SCU80[15]=1 & SCU90[31]=0 & SCU3C[3]=1,SPICS1#,SCU80[15]=1 & SCU90[31]=1,GPIOB7 +C4,SD1CLK,SCU90[0]=1,SCL10,SCU90[23]=1,GPIOC0 +B3,SD1CMD,SCU90[0]=1,SDA10,SCU90[23]=1,GPIOC1 +A2,SD1DAT0,SCU90[0]=1,SCL11,SCU90[24]=1,GPIOC2 +E5,SD1DAT1,SCU90[0]=1,SDA11,SCU90[24]=1,GPIOC3 +D4,SD1DAT2,SCU90[0]=1,SCL12,SCU90[25]=1,GPIOC4 +C3,SD1DAT3,SCU90[0]=1,SDA12,SCU90[25]=1,GPIOC5 +B2,SD1CD#,SCU90[0]=1,SCL13,SCU90[26]=1,GPIOC6 +A1,SD1WP#,SCU90[0]=1,SDA13,SCU90[26]=1,GPIOC7 +,,,,, +A18,SD2CLK,SCU90[1]=1,GPID0(In),SCU8C[8]=1 | Strap[21]=1,GPIOD0 +D16,SD2CMD,SCU90[1]=1,GPID0(Out),SCU8C[8]=1 | Strap[21]=1,GPIOD1 +B17,SD2DAT0,SCU90[1]=1,GPID2(In),SCU8C[9]=1 | Strap[21]=1,GPIOD2 +A17,SD2DAT1,SCU90[1]=1,GPID2(Out),SCU8C[9]=1 | Strap[21]=1,GPIOD3 +C16,SD2DAT2,SCU90[1]=1,GPID4(In),SCU8C[10]=1 | Strap[21]=1,GPIOD4 +B16,SD2DAT3,SCU90[1]=1,GPID4(Out),SCU8C[10]=1 | Strap[21]=1,GPIOD5 +A16,SD2CD#,SCU90[1]=1,GPID6(In),SCU8C[11]=1 | Strap[21]=1,GPIOD6 +E15,SD2WP#,SCU90[1]=1,GPID6(Out),SCU8C[11]=1 | Strap[21]=1,GPIOD7 +D15,NCTS3,SCU80[16]=1,GPIE0(In),SCU8C[12]=1 | Strap[22]=1,GPIOE0 +C15,NDCD3,SCU80[17]=1,GPIE0(Out),SCU8C[12]=1 | Strap[22]=1,GPIOE1 +B15,NDSR3,SCU80[18]=1,GPIE2(In),SCU8C[13]=1 | Strap[22]=1,GPIOE2 +A15,NRI3,SCU80[19]=1,GPIE2(Out),SCU8C[13]=1 | Strap[22]=1,GPIOE3 +E14,NDTR3,SCU80[20]=1,GPIE4(In),SCU8C[14]=1 | Strap[22]=1,GPIOE4 +D14,NRTS3,SCU80[21]=1,GPIE4(Out),SCU8C[14]=1 | Strap[22]=1,GPIOE5 +C14,TXD3,SCU80[22]=1,GPIE6(In),SCU8C[15]=1 | Strap[22]=1,GPIOE6 +B14,RXD3,SCU80[23]=1,GPIE6(Out),SCU8C[15]=1 | Strap[22]=1,GPIOE7 +D18,NCTS4,SCU80[24]=1,GPIOF0,, +B19,NDCD4,SCU80[25]=1,SIOPBI#,SCUA4[12]=1 | Strap[19]=0,GPIOF1 +A20,NDSR4,SCU80[26]=1,SIOPWRGD,SCUA4[13]=1 | Strap[19]=0,GPIOF2 +D17,NRI4,SCU80[27]=1,SIOPBO#,SCUA4[14]=1 | Strap[19]=0,GPIOF3 +B18,NDTR4,SCU80[28]=1,GPIOF4,, +A19,NRTS4,SCU80[29]=1,SIOSCI#,SCUA4[15]=1 | Strap[19]=0,GPIOF5 +E16,TXD4,SCU80[30]=1,GPIOF6,, +C17,RXD4,SCU80[31]=1,GPIOF7,, +A14,SGPSCK,SCU84[0]=1,GPIOG0,, +E13,SGPSLD,SCU84[1]=1,GPIOG1,, +D13,SGPSI0,SCU84[2]=1,GPIOG2,, +C13,SGPSI1,SCU84[3]=1,GPIOG3,, +,,,,, +B13,OSCCLK,SCU2C[1]=1,WDTRST1,SCU84[4]=1,GPIOG4 +Y21,USBCKI,Strap[23]=1,WDTRST2,SCU84[5]=1,GPIOG5 +AA22,FLBUSY#,SCU84[6]=1,GPIOG6,, +U18,FLWP#,SCU84[7]=1,GPIOG7,, +A8,ROMD8,"SCU90[6]=1 | Strap[4,1:0]=100",NCTS6,SCU90[7]=1,GPIOH0 +C7,ROMD9,"SCU90[6]=1 | Strap[4,1:0]=100",NDCD6,SCU90[7]=1,GPIOH1 +B7,ROMD10,"SCU90[6]=1 | Strap[4,1:0]=100",NDSR6,SCU90[7]=1,GPIOH2 +A7,ROMD11,"SCU90[6]=1 | Strap[4,1:0]=100",NRI6,SCU90[7]=1,GPIOH3 +D7,ROMD12,"SCU90[6]=1 | Strap[4,1:0]=100",NDTR6,SCU90[7]=1,GPIOH4 +B6,ROMD13,"SCU90[6]=1 | Strap[4,1:0]=100",NRTS6,SCU90[7]=1,GPIOH5 +A6,ROMD14,"SCU90[6]=1 | Strap[4,1:0]=100",TXD6,SCU90[7]=1,GPIOH6 +E7,ROMD15,"SCU90[6]=1 | Strap[4,1:0]=100",RXD6,SCU90[7]=1,GPIOH7 +C22,SYSCS#,Strap[13]=1,GPIOI0,, +G18,SYSCK,Strap[13]=1,GPIOI1,, +D19,SYSDO,Strap[13]=1,GPIOI2,, +C20,SYSDI,Strap[13]=1,GPIOI3,, +B22,SPICS0#,Strap[13:12]!=0,VBCS#,Strap[5]=1,GPIOI4 +G19,SPICK,Strap[13:12]!=0,VBCK,Strap[5]=1,GPIOI5 +C18,SPIDO,Strap[13:12]!=0,VBDO,Strap[5]=1,GPIOI6 +E20,SPIDI,Strap[13:12]!=0,VBDI,Strap[5]=1,GPIOI7 +J5,SGPMCK,SCU84[8]=1,GPIOJ0,, +J4,SGPMLD,SCU84[9]=1,GPIOJ1,, +K5,SGPMO,SCU84[10]=1,GPIOJ2,, +J3,SGPMI,SCU84[11]=1,GPIOJ3,, +T4,VGAHS,SCU84[12]=1,GPIOJ4,, +U2,VGAVS,SCU84[13]=1,GPIOJ5,, +T2,DDCCLK,SCU84[14]=1,GPIOJ6,, +T1,DDCDAT,SCU84[15]=1,GPIOJ7,, +,,,,, +E3,SCL5,SCU90[18]=1,GPIOK0,, +D2,SDA5,SCU90[18]=1,GPIOK1,, +C1,SCL6,SCU90[19]=1,GPIOK2,, +F4,SDA6,SCU90[19]=1,GPIOK3,, +E2,SCL7,SCU90[20]=1,GPIOK4,, +D1,SDA7,SCU90[20]=1,GPIOK5,, +G5,SCL8,SCU90[21]=1,GPIOK6,, +F3,SDA8,SCU90[21]=1,GPIOK7,, +U1,NCTS1,SCU84[16]=1,GPIOL0,, +T5,VPIDE,SCU90[5:4]!=0 & SCU84[17]=1,NDCD1,SCU84[17]=1,GPIOL1 +U3,VPIODD,SCU90[5:4]!=0 & SCU84[18]=1,NDSR1,SCU84[18]=1,GPIOL2 +V1,VPIHS,SCU90[5:4]!=0 & SCU84[19]=1,NRI1,SCU84[19]=1,GPIOL3 +U4,VPIVS,SCU90[5:4]!=0 & SCU84[20]=1,NDTR1,SCU84[20]=1,GPIOL4 +V2,VPICLK,SCU90[5:4]!=0 & SCU84[21]=1,NRTS1,SCU84[21]=1,GPIOL5 +W1,VPIB0,SCU90[5:4]=11 & SCU84[22]=1,TXD1,SCU84[22]=1,GPIOL6 +U5,VPIB1,SCU90[5:4]=11 & SCU84[23]=1,RXD1,SCU84[23]=1,GPIOL7 +V3,VPIB2,SCU90[5:4]!=0 & SCU84[24]=1,NCTS2,SCU84[24]=1,GPIOM0 +W2,VPIB3,SCU90[5:4]!=0 & SCU84[25]=1,NDCD2,SCU84[25]=1,GPIOM1 +Y1,VPIB4,SCU90[5:4]!=0 & SCU84[26]=1,NDSR2,SCU84[26]=1,GPIOM2 +V4,VPIB5,SCU90[5:4]!=0 & SCU84[27]=1,NRI2,SCU84[27]=1,GPIOM3 +W3,VPIB6,SCU90[5:4]!=0 & SCU84[28]=1,NDTR2,SCU84[28]=1,GPIOM4 +Y2,VPIB7,SCU90[5:4]!=0 & SCU84[29]=1,NRTS2,SCU84[29]=1,GPIOM5 +AA1,VPIB8,SCU90[5:4]!=0 & SCU84[30]=1,TXD2,SCU84[30]=1,GPIOM6 +V5,VPIB9,SCU90[5:4]!=0 & SCU84[31]=1,RXD2,SCU84[31]=1,GPIOM7 +W4,VPIG0,SCU90[5:4]=11 & SCU88[0]=1,PWM0,SCU88[0]=1,GPION0 +Y3,VPIG1,SCU90[5:4]=11 & SCU88[1]=1,PWM1,SCU88[1]=1,GPION1 +AA2,VPIG2,SCU90[5:4]!=0 & SCU88[2]=1,PWM2,SCU88[2]=1,GPION2 +AB1,VPIG3,SCU90[5:4]!=0 & SCU88[3]=1,PWM3,SCU88[3]=1,GPION3 +,,,,, +W5,VPIG4,SCU90[5:4]!=0 & SCU88[4]=1,PWM4,SCU88[4]=1,GPION4 +Y4,VPIG5,SCU90[5:4]!=0 & SCU88[5]=1,PWM5,SCU88[5]=1,GPION5 +AA3,VPIG6,SCU90[5:4]=10 & SCU88[6]=1,PWM6,SCU88[6]=1,GPION6 +AB2,VPIG7,SCU90[5:4]=10 & SCU88[7]=1,PWM7,SCU88[7]=1,GPION7 +V6,VPIG8,SCU90[5:4]=10 & SCU88[8]=1,GPIOO0/TACH0,, +Y5,VPIG9,SCU90[5:4]=10 & SCU88[9]=1,GPIOO1/TACH1,, +AA4,VPIR0,SCU90[5:4]=11 & SCU88[10]=1,GPIOO2/TACH2,, +AB3,VPIR1,SCU90[5:4]=11 & SCU88[11]=1,GPIOO3/TACH3,, +W6,VPIR2,SCU90[5:4]=10 & SCU88[12]=1,GPIOO4/TACH4,, +AA5,VPIR3,SCU90[5:4]=10 & SCU88[13]=1,GPIOO5/TACH5,, +AB4,VPIR4,SCU90[5:4]=10 & SCU88[14]=1,GPIOO6/TACH6,, +V7,VPIR5,SCU90[5:4]=10 & SCU88[15]=1,GPIOO7/TACH7,, +Y6,VPIR6,SCU90[5:4]=10 & SCU88[16]=1,GPIOP0/TACH8,, +AB5,VPIR7,SCU90[5:4]=10 & SCU88[17]=1,GPIOP1/TACH9,, +W7,VPIR8,SCU90[5:4]=10 & SCU88[18]=1,GPIOP2/TACH10,, +AA6,VPIR9,SCU90[5:4]=10 & SCU88[19]=1,GPIOP3/TACH11,, +AA7,BMCINT,SCU88[22]=1,GPIOP6/TACH14,, +AB7,FLACK,SCU88[23]=1,GPIOP7/TACH15,, +D3,SCL3,SCU90[16]=1,GPIOQ0,, +C2,SDA3,SCU90[16]=1,GPIOQ1,, +B1,SCL4,SCU90[17]=1,GPIOQ2,, +F5,SDA4,SCU90[17]=1,GPIOQ3,, +H4,SCL14,SCU90[27]=1,GPIOQ4,, +H3,SDA14,SCU90[27]=1,GPIOQ5,, +H2,-,SCU90[28]=1,GPIOQ6,, +H1,-,SCU90[28]=1,GPIOQ7,, +V20,ROMCS1#,SCU88[24]=1,GPIOR0,, +W21,ROMCS2#,SCU88[25]=1,GPIOR1,, +,,,,, +Y22,ROMCS3#,SCU88[26]=1,GPIOR2,, +U19,ROMCS4#,SCU88[27]=1,GPIOR3,, +V21,ROMA24,SCU88[28]=1 & SCU94[1]=0,VPOR6,SCU88[28]=1 & SCU94[1]=1,GPIOR4 +W22,ROMA25,SCU88[29]=1 & SCU94[1]=0,VPOR7,SCU88[29]=1 & SCU94[1]=1,GPIOR5 +C6,MDC1,SCU88[30]=1,GPIOR6, , +A5,MDIO1,SCU88[31]=1,GPIOR7, , +U21,ROMD4,SCU8C[0]=1 & SCU94[1:0]=0,VPODE,SCU8C[0]=1 & SCU94[1:0]!=0,GPIOS0 +T19,ROMD5,SCU8C[1]=1 & SCU94[1:0]=0,VPOHS,SCU8C[1]=1 & SCU94[1:0]!=0,GPIOS1 +V22,ROMD6,SCU8C[2]=1 & SCU94[1:0]=0,VPOVS,SCU8C[2]=1 & SCU94[1:0]!=0,GPIOS2 +U20,ROMD7,SCU8C[3]=1 & SCU94[1:0]=0,VPOCLK,SCU8C[3]=1 & SCU94[1:0]!=0,GPIOS3 +R18,ROMOE#,SCU8C[4]=1,GPIOS4, , +N21,ROMWE#,SCU8C[5]=1,GPIOS5, , +L22,ROMA22,SCU8C[6]=1 & SCU94[1]=0,VPOR4,SCU8C[6]=1 & SCU94[1]=1,GPIOS6 +K18,ROMA23,SCU8C[7]=1 & SCU94[1]=0,VPOR5,SCU8C[7]=1 & SCU94[1]=1,GPIOS7 +A12,GPIOT0,SCUA0[0]=1,RMII1TXEN,Strap[6]=0,RGMII1TXCK +B12,GPIOT1,SCUA0[1]=1,-,Strap[6]=0,RGMII1TXCTL +C12,GPIOT2,SCUA0[2]=1,RMII1TXD0,Strap[6]=0,RGMII1TXD0 +D12,GPIOT3,SCUA0[3]=1,RMII1TXD1,Strap[6]=0,RGMII1TXD1 +E12,GPIOT4,SCUA0[4]=1,-,Strap[6]=0,RGMII1TXD2 +A13,GPIOT5,SCUA0[5]=1,-,Strap[6]=0,RGMII1TXD3 +D9,GPIOT6,SCUA0[6]=1,RMII2TXEN,Strap[7]=0,RGMII2TXCK +E9,GPIOT7,SCUA0[7]=1,-,Strap[7]=0,RGMII2TXCTL +A10,GPIOU0,SCUA0[8]=1,RMII2TXD0,Strap[7]=0,RGMII2TXD0 +B10,GPIOU1,SCUA0[9]=1,RMII2TXD1,Strap[7]=0,RGMII2TXD1 +C10,GPIOU2,SCUA0[10]=1,-,Strap[7]=0,RGMII2TXD2 +D10,GPIOU3,SCUA0[11]=1,-,Strap[7]=0,RGMII2TXD3 +E11,GPIOU4,SCUA0[12]=1,RMII1RCLK,Strap[6]=0,RGMII1RXCK +D11,GPIOU5,SCUA0[13]=1,-,Strap[6]=0,RGMII1RXCTL +,,,,, +C11,GPIOU6,SCUA0[14]=1,RMII1RXD0,Strap[6]=0,RGMII1RXD0 +B11,GPIOU7,SCUA0[15]=1,RMII1RXD1,Strap[6]=0,RGMII1RXD1 +A11,GPIOV0,SCUA0[16]=1,RMII1CRSDV,Strap[6]=0,RGMII1RXD2 +E10,GPIOV1,SCUA0[17]=1,RMII1RXER,Strap[6]=0,RGMII1RXD3 +C9,GPIOV2,SCUA0[18]=1,RMII2RCLK,Strap[7]=0,RGMII2RXCK +B9,GPIOV3,SCUA0[19]=1,-,Strap[7]=0,RGMII2RXCTL +A9,GPIOV4,SCUA0[20]=1,RMII2RXD0,Strap[7]=0,RGMII2RXD0 +E8,GPIOV5,SCUA0[21]=1,RMII2RXD1,Strap[7]=0,RGMII2RXD1 +D8,GPIOV6,SCUA0[22]=1,RMII2CRSDV,Strap[7]=0,RGMII2RXD2 +C8,GPIOV7,SCUA0[23]=1,RMII2RXER,Strap[7]=0,RGMII2RXD3 +L5,GPIW0,SCUA0[24]=1,ADC0,, +L4,GPIW1,SCUA0[25]=1,ADC1,, +L3,GPIW2,SCUA0[26]=1,ADC2,, +L2,GPIW3,SCUA0[27]=1,ADC3,, +L1,GPIW4,SCUA0[28]=1,ADC4,, +M5,GPIW5,SCUA0[29]=1,ADC5,, +M4,GPIW6,SCUA0[30]=1,ADC6,, +M3,GPIW7,SCUA0[31]=1,ADC7,, +M2,GPIX0,SCUA4[0]=1,ADC8,, +M1,GPIX1,SCUA4[1]=1,ADC9,, +N5,GPIX2,SCUA4[2]=1,ADC10,, +N4,GPIX3,SCUA4[3]=1,ADC11,, +N3,GPIX4,SCUA4[4]=1,ADC12,, +N2,GPIX5,SCUA4[5]=1,ADC13,, +N1,GPIX6,SCUA4[6]=1,ADC14,, +P5,GPIX7,SCUA4[7]=1,ADC15,, +C21,SIOS3#,SCUA4[8]=1 | Strap[19]=0,GPIOY0,, +F20,SIOS5#,SCUA4[9]=1 | Strap[19]=0,GPIOY1,, +,,,,, +G20,SIOPWREQ#,SCUA4[10]=1 | Strap[19]=0,GPIOY2,, +K20,SIOONCTRL#,SCUA4[11]=1 | Strap[19]=0,GPIOY3,, +R22,ROMA2,SCUA4[16]=1 & SCU94[1:0]=0,VPOB0,SCUA4[16]=1 & SCU94[1:0]!=0,GPIOZ0 +P18,ROMA3,SCUA4[17]=1 & SCU94[1:0]=0,VPOB1,SCUA4[17]=1 & SCU94[1:0]!=0,GPIOZ1 +P19,ROMA4,SCUA4[18]=1 & SCU94[1:0]=0,VPOB2,SCUA4[18]=1 & SCU94[1:0]!=0,GPIOZ2 +P20,ROMA5,SCUA4[19]=1 & SCU94[1:0]=0,VPOB3,SCUA4[19]=1 & SCU94[1:0]!=0,GPIOZ3 +P21,ROMA6,SCUA4[20]=1 & SCU94[1:0]=0,VPOB4,SCUA4[20]=1 & SCU94[1:0]!=0,GPIOZ4 +P22,ROMA7,SCUA4[21]=1 & SCU94[1:0]=0,VPOB5,SCUA4[21]=1 & SCU94[1:0]!=0,GPIOZ5 +M21,ROMA8,SCUA4[22]=1 & SCU94[1:0]=0,VPOB6,SCUA4[22]=1 & SCU94[1:0]!=0,GPIOZ6 +M22,ROMA9,SCUA4[23]=1 & SCU94[1:0]=0,VPOB7,SCUA4[23]=1 & SCU94[1:0]!=0,GPIOZ7 +L18,ROMA10,SCUA4[24]=1 & SCU94[1:0]=0,VPOG0,SCUA4[24]=1 & SCU94[1:0]!=0,GPIOAA0 +L19,ROMA11,SCUA4[25]=1 & SCU94[1:0]=0,VPOG1,SCUA4[25]=1 & SCU94[1:0]!=0,GPIOAA1 +L20,ROMA12,SCUA4[26]=1 & SCU94[1:0]=0,VPOG2,SCUA4[26]=1 & SCU94[1:0]!=0,GPIOAA2 +L21,ROMA13,SCUA4[27]=1 & SCU94[1:0]=0,VPOG3,SCUA4[27]=1 & SCU94[1:0]!=0,GPIOAA3 +T18,ROMA14,SCUA4[28]=1 & SCU94[1]=0,VPOG4,SCUA4[28]=1 & SCU94[1]=1,GPIOAA4 +N18,ROMA15,SCUA4[29]=1 & SCU94[1]=0,VPOG5,SCUA4[29]=1 & SCU94[1]=1,GPIOAA5 +N19,ROMA16,SCUA4[30]=1 & SCU94[1]=0,VPOG6,SCUA4[30]=1 & SCU94[1]=1,GPIOAA6 +M19,ROMA17,SCUA4[31]=1 & SCU94[1]=0,VPOG7,SCUA4[31]=1 & SCU94[1]=1,GPIOAA7 +M20,ROMA18,SCUA8[0]=1 & SCU94[1]=0,VPOR0,SCUA8[0]=1 & SCU94[1]=1,GPIOAB0 +M18,ROMA19,SCUA8[1]=1 & SCU94[1]=0,VPOR1,SCUA8[1]=1 & SCU94[1]=1,GPIOAB1 +N22,ROMA20,SCUA8[2]=1 & SCU94[1]=0,VPOR2,SCUA8[2]=1 & SCU94[1]=1,GPIOAB2 +N20,ROMA21,SCUA8[3]=1 & SCU94[1]=0,VPOR3,SCUA8[3]=1 & SCU94[1]=1,GPIOAB3 +K4,UB11_HDP2,SCU90[3]=1,UB11_DP,, +K3,UB11_HDN2,SCU90[3]=1,UB11_DN,, +AB21,USB2_HDP,SCU90[29]=1,USB2_DP,, +AB20,USB2_HDN,SCU90[29]=1,USB2_DN,, diff --git a/meta-aspeed/recipes-utils/openbmc-gpio/files/soc_gpio.py b/meta-aspeed/recipes-utils/openbmc-gpio/files/soc_gpio.py new file mode 100644 index 0000000..ea3c8d3 --- /dev/null +++ b/meta-aspeed/recipes-utils/openbmc-gpio/files/soc_gpio.py @@ -0,0 +1,42 @@ +# 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 phymemory + + +_soc_reg_map = {} + + +class SCUReg(phymemory.PhyMemory): + SCU_REG_MAX = 0x1A4 + SCU_ADDR_BASE = 0x1E6E2000 + def __init__(self, reg): + assert 0 <= reg <= self.SCU_REG_MAX + self.reg = reg + super(SCUReg, self).__init__(self.SCU_ADDR_BASE + reg, 'SCU%X' % reg) + + +def soc_get_register(addr): + if addr in _soc_reg_map: + return _soc_reg_map[addr] + reg = SCUReg(addr) + _soc_reg_map[addr] = reg + return reg diff --git a/meta-aspeed/recipes-utils/openbmc-gpio/openbmc-gpio_%.bbappend b/meta-aspeed/recipes-utils/openbmc-gpio/openbmc-gpio_%.bbappend new file mode 100644 index 0000000..a87a8c9 --- /dev/null +++ b/meta-aspeed/recipes-utils/openbmc-gpio/openbmc-gpio_%.bbappend @@ -0,0 +1,23 @@ +# 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://soc_gpio.py \ + file://ast2400_gpio_table.py \ + " diff --git a/meta-aspeed/recipes-utils/soc-utils/files/COPYING b/meta-aspeed/recipes-utils/soc-utils/files/COPYING new file mode 100644 index 0000000..3912109 --- /dev/null +++ b/meta-aspeed/recipes-utils/soc-utils/files/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program 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; either version 2 of the License, or + (at your option) any later version. + + 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; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/meta-aspeed/recipes-utils/soc-utils/files/soc-utils.sh b/meta-aspeed/recipes-utils/soc-utils/files/soc-utils.sh new file mode 100644 index 0000000..33d772f --- /dev/null +++ b/meta-aspeed/recipes-utils/soc-utils/files/soc-utils.sh @@ -0,0 +1,20 @@ +# 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 + +scu_addr() { + echo $((0x1E6E2000 + 0x$1)) +} diff --git a/meta-aspeed/recipes-utils/soc-utils/openbmc-utils_%.bbappend b/meta-aspeed/recipes-utils/soc-utils/openbmc-utils_%.bbappend new file mode 100644 index 0000000..cb8d362 --- /dev/null +++ b/meta-aspeed/recipes-utils/soc-utils/openbmc-utils_%.bbappend @@ -0,0 +1,26 @@ +# 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://soc-utils.sh \ + " + +OPENBMC_UTILS_FILES += " \ + soc-utils.sh \ + " |