diff options
author | Michael Niewöhner <foss@mniewoehner.de> | 2020-12-11 21:26:02 +0100 |
---|---|---|
committer | Michael Niewöhner <foss@mniewoehner.de> | 2020-12-28 17:47:04 +0000 |
commit | dbb667ac08f8283eb38861151f971efd46736ab6 (patch) | |
tree | 6f05ddb27c8dab11f11cac66fa4a4aee4381d662 /util/sconfig/sconfig.tab.h_shipped | |
parent | 5c2efa1990853545664a6f6e3ff94be79477d407 (diff) |
device + util/sconfig: introduce new device `gpio`
Introduce a new device `gpio` that is going to be used for generic
abstraction of gpio operations in the devicetree.
The general idea behind this is that every chip can have gpios that
shall be accessible in a very generic way by any driver through the
devicetree.
The chip that implements the chip-specific gpio operations has to assign
them to the generic device operations struct, which then gets assigned
to the gpio device during device probing. See CB:48583 for how this gets
done for the SoCs using intelblocks/gpio.
The gpio device then can be added to the devicetree with an alias name
like in the following example:
chip soc/whateverlake
device gpio 0 alias soc_gpio on end
...
end
Any driver that requires access to this gpio device needs to have a
device pointer (or multiple) and an option for specifying the gpio to be
used in its chip config like this:
struct drivers_ipmi_config {
...
DEVTREE_CONST struct device *gpio_dev;
u16 post_complete_gpio;
...
};
The device `soc_gpio` can then be linked to the chip driver's `gpio_dev`
above by using the syntax `use ... as ...`, which was introduced in
commit 8e1ea52:
chip drivers/ipmi
use soc_gpio as gpio_dev
register "bmc_jumper_gpio" = "GPP_D22"
...
end
The IPMI driver can then use the generic gpio operations without any
knowlege of the chip's specifics:
unsigned int gpio_val;
const struct gpio_operations *gpio_ops;
gpio_ops = dev_get_gpio_ops(conf->gpio_dev);
gpio_val = gpio_ops->get(conf->bmc_jumper_gpio);
For a full example have a look at CB:48096 and CB:48095.
This change adds the new device type to sconfig and adds generic gpio
operations to the `device_operations` struct. Also, a helper for getting
the gpio operations from a device after checking them for NULL pointers
gets added.
Successfully tested on Supermicro X11SSM-F with CB:48097, X11SSH-TF with
CB:48711 and OCP DeltaLake with CB:48672.
Change-Id: Ic4572ad8b37bd1afd2fb213b2c67fb8aec536786
Tested-by: Johnny Lin <Johnny_Lin@wiwynn.com>
Tested-by: Michael Niewöhner <foss@mniewoehner.de>
Tested-by: Patrick Rudolph <siro@das-labor.org>
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/48582
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'util/sconfig/sconfig.tab.h_shipped')
-rw-r--r-- | util/sconfig/sconfig.tab.h_shipped | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/util/sconfig/sconfig.tab.h_shipped b/util/sconfig/sconfig.tab.h_shipped index b05831fc33..6983c3bb76 100644 --- a/util/sconfig/sconfig.tab.h_shipped +++ b/util/sconfig/sconfig.tab.h_shipped @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.6.3. */ +/* A Bison parser, made by GNU Bison 3.7.2. */ /* Bison interface for Yacc-like parsers in C @@ -35,8 +35,8 @@ especially those whose name start with YY_ or yy_. They are private implementation details that can be changed or removed. */ -#ifndef YY_YY_SRC_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED -# define YY_YY_SRC_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED +#ifndef YY_YY_HOME_C0D3_SRC_COREBOOT_GIT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED +# define YY_YY_HOME_C0D3_SRC_COREBOOT_GIT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -92,10 +92,11 @@ extern int yydebug; MMIO = 293, /* MMIO */ LPC = 294, /* LPC */ ESPI = 295, /* ESPI */ - FW_CONFIG_TABLE = 296, /* FW_CONFIG_TABLE */ - FW_CONFIG_FIELD = 297, /* FW_CONFIG_FIELD */ - FW_CONFIG_OPTION = 298, /* FW_CONFIG_OPTION */ - FW_CONFIG_PROBE = 299 /* FW_CONFIG_PROBE */ + GPIO = 296, /* GPIO */ + FW_CONFIG_TABLE = 297, /* FW_CONFIG_TABLE */ + FW_CONFIG_FIELD = 298, /* FW_CONFIG_FIELD */ + FW_CONFIG_OPTION = 299, /* FW_CONFIG_OPTION */ + FW_CONFIG_PROBE = 300 /* FW_CONFIG_PROBE */ }; typedef enum yytokentype yytoken_kind_t; #endif @@ -108,7 +109,7 @@ union YYSTYPE struct device *dev; struct chip_instance *chip_instance; char *string; - int number; + uint64_t number; }; @@ -122,4 +123,4 @@ extern YYSTYPE yylval; int yyparse (void); -#endif /* !YY_YY_SRC_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */ +#endif /* !YY_YY_HOME_C0D3_SRC_COREBOOT_GIT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */ |