x86: coral: Add support for Cr50
Subsystems (6)
v2 cover x86: coral: Add support for Cr50
This series adds a driver for the Cr50 security chip and enables it on coral. This supports the 'tpm' command.
In order to make this work a few other changes are included:
- Additional UCLASS_IRQ operations to support requesting and reading interrupts, using the device tree
- A driver for ACPI general-purpose events
There are also a few small clean-ups to the recently landed Apollo Lake support.
This series relies on this patch:
http://patchwork.ozlabs.org/patch/1214541/
Changes in v2:
- Significant rewrite of cr50 init procedure
- Support use of interrupts
- Update the commit message
- Add new patches to handle requesting interrupts and interrupt state
Simon Glass (13):
x86: Add a clock driver for Intel devices
x86: apl: Use the clock driver
x86: apl: Drop the I2C config in FSP-S
x86: coral: Update i2c and rtc status
dm: irq: Add support for interrupt controller types
x86: Give each driver an IRQ type
x86: itss: Add of-platdata support
dm: irq: Add support for requesting interrupts
x86: Add support for ACPI general-purpose events
x86: coral: Add I2C and TPM device-tree definitions
tpm: Add more TPM2 definitions
tpm: Add a driver for H1/Cr50
x86: coral: Enable TPM
arch/sandbox/dts/test.dts | 5 +- arch/sandbox/include/asm/test.h | 4 + arch/x86/Kconfig | 33 + arch/x86/cpu/Makefile | 1 + arch/x86/cpu/acpi_gpe.c | 85 +++ arch/x86/cpu/apollolake/Kconfig | 4 + arch/x86/cpu/apollolake/fsp_s.c | 62 +- arch/x86/cpu/apollolake/itss.c | 12 +- arch/x86/cpu/i386/interrupt.c | 3 +- arch/x86/cpu/irq.c | 3 +- arch/x86/dts/chromebook_coral.dts | 93 +++ configs/chromebook_coral_defconfig | 3 +- doc/board/google/chromebook_coral.rst | 2 - .../interrupt-controller/intel,acpi-gpe.txt | 30 + .../interrupt-controller/interrupts.txt | 131 ++++ drivers/clk/Kconfig | 10 + drivers/clk/Makefile | 1 + drivers/clk/intel/Makefile | 6 + drivers/clk/intel/clk_intel.c | 41 ++ drivers/misc/irq-uclass.c | 140 +++- drivers/misc/irq_sandbox.c | 43 +- drivers/pinctrl/intel/pinctrl.c | 2 +- drivers/tpm/Kconfig | 10 + drivers/tpm/Makefile | 1 + drivers/tpm/cr50_i2c.c | 661 ++++++++++++++++++ include/dt-bindings/clock/intel-clock.h | 15 + include/irq.h | 138 ++++ include/tpm-v2.h | 31 + test/dm/irq.c | 45 ++ 29 files changed, 1545 insertions(+), 70 deletions(-) create mode 100644 arch/x86/cpu/acpi_gpe.c create mode 100644 doc/device-tree-bindings/interrupt-controller/intel,acpi-gpe.txt create mode 100644 doc/device-tree-bindings/interrupt-controller/interrupts.txt create mode 100644 drivers/clk/intel/Makefile create mode 100644 drivers/clk/intel/clk_intel.c create mode 100644 drivers/tpm/cr50_i2c.c create mode 100644 include/dt-bindings/clock/intel-clock.h
Signature · 1 line
2.24.1.735.g03f4e72817-goog
PATCH v2 1/13 x86: Add a clock driver for Intel devices
So far we have avoided adding a clock driver for Intel devices. But the Designware I2C driver needs a different clock (133MHz) on Intel devices than on others (166MHz). Add a simple driver that provides this information.
This driver can be expanded later as needed.
---
Changes in v2: None
drivers/clk/Kconfig | 10 ++++++ drivers/clk/Makefile | 1 + drivers/clk/intel/Makefile | 6 ++++ drivers/clk/intel/clk_intel.c | 41 +++++++++++++++++++++++++ include/dt-bindings/clock/intel-clock.h | 15 +++++++++ 5 files changed, 73 insertions(+) create mode 100644 drivers/clk/intel/Makefile create mode 100644 drivers/clk/intel/clk_intel.c create mode 100644 include/dt-bindings/clock/intel-clock.h
drivers/clk/Kconfig +10 -0
@@ -73,6 +73,16 @@ config CLK_COMPOSITE_CCF Enable this option if you want to (re-)use the Linux kernel's Common Clock Framework [CCF] composite code in U-Boot's clock driver. +config CLK_INTEL + bool "Enable clock driver for Intel x86" + depends on CLK && X86 + help + This provides very basic support for clocks on Intel SoCs. The driver + is barely used at present but could be expanded as needs arise. + Much clock configuration in U-Boot is either set up by the FSP, or + set up by U-Boot itself but only statically. Thus the driver does not + support changing clock rates, only querying them. + config CLK_STM32F bool "Enable clock driver support for STM32F family" depends on CLK && (STM32F7 || STM32F4)
drivers/clk/Makefile +1 -0
@@ -25,6 +25,7 @@ obj-$(CONFIG_CLK_MVEBU) += mvebu/ obj-$(CONFIG_CLK_BCM6345) += clk_bcm6345.o obj-$(CONFIG_CLK_BOSTON) += clk_boston.o obj-$(CONFIG_CLK_EXYNOS) += exynos/ +obj-$(CONFIG_$(SPL_TPL_)CLK_INTEL) += intel/ obj-$(CONFIG_CLK_HSDK) += clk-hsdk-cgu.o obj-$(CONFIG_CLK_MPC83XX) += mpc83xx_clk.o obj-$(CONFIG_CLK_OWL) += owl/
drivers/clk/intel/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright 2010 Google LLC +# + +obj-y += clk_intel.o
drivers/clk/intel/clk_intel.c new file +41 -0
41 lines not on this page · raw message
include/dt-bindings/clock/intel-clock.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* This header provides constants for Intel clocks. +* +* The constants defined in this header are used in the device tree +* +* Copyright 2019 Google LLC +*/ + +#ifndef _DT_BINDINGS_CLK_INTEL_H +#define _DT_BINDINGS_CLK_INTEL_H + +#define CLK_I2C 1 + +#endif
Signature · 1 line
2.24.1.735.g03f4e72817-goog
PATCH v2 1/13 x86: Add a clock driver for Intel devices
Quoted 13 lines · Simon Glass
So far we have avoided adding a clock driver for Intel devices. But the Designware I2C driver needs a different clock (133MHz) on Intel devices than on others (166MHz). Add a simple driver that provides this information.
This driver can be expanded later as needed.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
Quoted 10 lines
drivers/clk/Kconfig | 10 ++++++ drivers/clk/Makefile | 1 + drivers/clk/intel/Makefile | 6 ++++ drivers/clk/intel/clk_intel.c | 41 +++++++++++++++++++++++++ include/dt-bindings/clock/intel-clock.h | 15 +++++++++ 5 files changed, 73 insertions(+) create mode 100644 drivers/clk/intel/Makefile create mode 100644 drivers/clk/intel/clk_intel.c create mode 100644 include/dt-bindings/clock/intel-clock.h
PATCH v2 2/13 x86: apl: Use the clock driver
In reply to Simon GlassEnable the Intel clock driver and modify coral's device tree to use it.
---
Changes in v2: None
arch/x86/cpu/apollolake/Kconfig | 3 +++ arch/x86/dts/chromebook_coral.dts | 6 ++++++ 2 files changed, 9 insertions(+)
arch/x86/cpu/apollolake/Kconfig +3 -0
@@ -39,6 +39,9 @@ config INTEL_APOLLOLAKE imply HAVE_X86_FIT imply INTEL_GPIO imply SMP + imply CLK + imply CMD_CLK + imply CLK_INTEL if INTEL_APOLLOLAKE
arch/x86/dts/chromebook_coral.dts +6 -0
@@ -15,6 +15,7 @@ #include "flashmap-16mb-rw.dtsi" #endif +#include <dt-bindings/clock/intel-clock.h> #include <asm/intel_pinctrl_defs.h> #include <asm/arch-apollolake/cpu.h> #include <asm/arch-apollolake/gpio.h>
@@ -39,6 +40,11 @@ stdout-path = &serial; }; + clk: clock { + compatible = "intel,apl-clk"; + #clock-cells = <1>; + }; + cpus { u-boot,dm-pre-reloc; #address-cells = <1>;
Signature · 1 line
2.24.1.735.g03f4e72817-goog
PATCH v2 2/13 x86: apl: Use the clock driver
Hi Simon,
Quoted 31 lines · Simon Glass
Enable the Intel clock driver and modify coral's device tree to use it.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
arch/x86/cpu/apollolake/Kconfig | 3 +++ arch/x86/dts/chromebook_coral.dts | 6 ++++++ 2 files changed, 9 insertions(+)arch/x86/cpu/apollolake/Kconfig +3
-0@@ -39,6 +39,9 @@ config INTEL_APOLLOLAKE imply HAVE_X86_FIT imply INTEL_GPIO imply SMP + imply CLK + imply CMD_CLK + imply CLK_INTEL if INTEL_APOLLOLAKEarch/x86/dts/chromebook_coral.dts +0
-0
arch/x86/dts/chromebook_coral.dts line 18
Quoted 4 lines
arch/x86/dts/chromebook_coral.dts +1
-0@@ -15,6 +15,7 @@ #include "flashmap-16mb-rw.dtsi" #endif +#include <dt-bindings/clock/intel-clock.h>
nits: this include is not needed in this commit, but should be put in the patch that actually references CLK_I2C.
Quoted 6 lines
arch/x86/dts/chromebook_coral.dts +0
-0#include <asm/intel_pinctrl_defs.h> #include <asm/arch-apollolake/cpu.h> #include <asm/arch-apollolake/gpio.h>@@ -39,6 +40,11 @@ stdout-path = &serial; };
arch/x86/dts/chromebook_coral.dts
Quoted 10 lines
arch/x86/dts/chromebook_coral.dts +5
-1+ clk: clock { + compatible = "intel,apl-clk"; + #clock-cells = <1>; + }; + cpus { u-boot,dm-pre-reloc; #address-cells = <1>; --
Other than above,
Regards,
Bin
PATCH v2 3/13 x86: apl: Drop the I2C config in FSP-S
In reply to Simon GlassThis config is not actually used here and in U-Boot it seems better to set this using the device tree for each individual controller. The monolithic config of the FSP-S is only necessary if the FSP is actually configuring something, but here it is not.
The FSP-S does enable/disable the various I2C ports. It might be nice to handle this using the okay/disabled property of each port, but that can be considered later.
---
Changes in v2: None
arch/x86/cpu/apollolake/fsp_s.c | 58 --------------------------------- 1 file changed, 58 deletions(-)
arch/x86/cpu/apollolake/fsp_s.c +0 -58
@@ -24,7 +24,6 @@#define HIDE_BIT BIT(0)#define INTEL_GSPI_MAX 3 -#define INTEL_I2C_DEV_MAX 8#define MAX_USB2_PORTS 8enum {
@@ -32,36 +31,6 @@ enum { CHIPSET_LOCKDOWN_COREBOOT, /* coreboot handles locking */ }; -enum i2c_speed { -I2C_SPEED_STANDARD =100000 , -I2C_SPEED_FAST =400000 , -I2C_SPEED_FAST_PLUS =1000000 , -I2C_SPEED_HIGH =3400000 , -I2C_SPEED_FAST_ULTRA =5000000 , -}; - -/* -* Timing values are in units of clock period, with the clock speed -* provided by the SOC -* -* TODO(sjg at chromium.org): Connect this up to the I2C driver -*/ -struct dw_i2c_speed_config { -enum i2c_speed speed; -/* SCL high and low period count */ -u16 scl_lcnt; -u16 scl_hcnt; -/* -* SDA hold time should be 300ns in standard and fast modes -* and long enough for deterministic logic level change in -* fast-plus and high speed modes. -* -* [15:0] SDA TX Hold Time -* [23:16] SDA RX Hold Time -*/ -u32 sda_hold; -}; -/* Serial IRQ control. SERIRQ_QUIET is the default (0) */ enum serirq_mode {SERIRQ_QUIET ,
@@ -69,32 +38,6 @@ enum serirq_mode { SERIRQ_OFF, }; -/* -* This I2C controller has support for 3 independent speed configs but can -* support both FAST_PLUS and HIGH speeds through the same set of speed -* config registers. These are treated separately so the speed config values -* can be provided via ACPI to the OS. -*/ -#define DW_I2C_SPEED_CONFIG_COUNT 4 - -struct dw_i2c_bus_config { -/* Bus should be enabled in TPL with temporary base */ -int early_init; -/* Bus speed in Hz, default is I2C_SPEED_FAST (400 KHz) */ -enum i2c_speed speed; -/* -* If rise_time_ns is non-zero the calculations for lcnt and hcnt -* registers take into account the times of the bus. However, if -* there is a match in speed_config those register values take -* precedence -*/ -int rise_time_ns; -int fall_time_ns; -int data_hold_time_ns; -/* Specific bus speed configuration */ -struct dw_i2c_speed_config speed_config[DW_I2C_SPEED_CONFIG_COUNT ]; -}; -struct gspi_cfg {/* Bus speed in MHz */ u32 speed_mhz;
@@ -110,7 +53,6 @@ struct gspi_cfg {struct soc_intel_common_config {int chipset_lockdown;struct gspi_cfg gspi[INTEL_GSPI_MAX ]; -struct dw_i2c_bus_config i2c[INTEL_I2C_DEV_MAX ]; };enum pnp_settings {
Signature · 1 line
2.24.1.735.g03f4e72817-goog
PATCH v2 3/13 x86: apl: Drop the I2C config in FSP-S
Quoted 10 lines · Simon Glass
This config is not actually used here and in U-Boot it seems better to set this using the device tree for each individual controller. The monolithic config of the FSP-S is only necessary if the FSP is actually configuring something, but here it is not.
The FSP-S does enable/disable the various I2C ports. It might be nice to handle this using the okay/disabled property of each port, but that can be considered later.
Quoted 8 lines
Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
arch/x86/cpu/apollolake/fsp_s.c | 58 --------------------------------- 1 file changed, 58 deletions(-)
PATCH v2 4/13 x86: coral: Update i2c and rtc status
In reply to Simon GlassThese are actually working correctly, so update the status.
---
Changes in v2: None
doc/board/google/chromebook_coral.rst | 2 -- 1 file changed, 2 deletions(-)
doc/board/google/chromebook_coral.rst +0 -2
@@ -211,9 +211,7 @@ To do - left-side USB - USB-C - Cr50 (security chip: a basic driver is running but not included here) - - I2C (driver exists but not enabled in device tree) - Sound (Intel I2S support exists, but need da7219 driver) - - RTC (driver exists but not enabled in device tree) - Various minor features supported by LPC, etc. - Booting Chrome OS, e.g. with verified boot - Integrate with Chrome OS vboot
Signature · 1 line
2.24.1.735.g03f4e72817-goog
PATCH v2 4/13 x86: coral: Update i2c and rtc status
Quoted 11 lines · Simon Glass
These are actually working correctly, so update the status.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
doc/board/google/chromebook_coral.rst | 2 -- 1 file changed, 2 deletions(-)
PATCH v2 5/13 dm: irq: Add support for interrupt controller types
In reply to Simon GlassThere can be different types of interrupt controllers in a system and some drivers may need to distinguish between these. In general this can be handled using the device tree by adding the interrupt information to device nodes.
However on x86 devices we have interrupt controllers which are not tied to any particular device and not really used in U-Boot. These still need to be inited, so a convenient method is to give each controller a type and allow a particular controller type to be probed.
Add support for this in sandbox along with a test.
---
Changes in v2: None
arch/sandbox/include/asm/test.h | 4 ++++ drivers/misc/irq-uclass.c | 24 +++++++++++++++++++++++- drivers/misc/irq_sandbox.c | 2 +- include/irq.h | 21 +++++++++++++++++++++ test/dm/irq.c | 14 ++++++++++++++ 5 files changed, 63 insertions(+), 2 deletions(-)
arch/sandbox/include/asm/test.h +4 -0
@@ -45,6 +45,10 @@#define PCI_EA_BAR2_MAGIC 0x72727272#define PCI_EA_BAR4_MAGIC 0x74747474 +enum { +SANDBOX_IRQN_PEND =1 ,/* Interrupt number for 'pending' test */ +}; +/* System controller driver data */ enum {SYSCON0 =32 ,
drivers/misc/irq-uclass.c +23 -1
@@ -1,11 +1,13 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Copyright (C) 2015, Bin Meng <[email protected]> +* Copyright 2019 Google, LLC +* Written by Simon Glass <[email protected]> */ #include <common.h> #include <dm.h> #include <irq.h> +#include <dm/device-internal.h> int irq_route_pmc_gpio_gpe (struct udevice *dev,uint pmc_gpe_num) {
@@ -47,6 +49,26 @@ int irq_restore_polarities(struct udevice *dev)return ops->restore_polarities (dev); } +int irq_first_device_type (enum irq_dev_t type,struct udevice **devp) +{ +struct udevice *dev; +struct uclass *uc; +int ret; + + ret =uclass_get (UCLASS_IRQ , &uc); +if (ret) +return ret; + uclass_foreach_dev(dev, uc) { +if (dev_get_driver_data (dev) == type) { + *devp = dev; + +return device_probe (dev); + } + } + +return -ENODEV ; +} +UCLASS_DRIVER (irq) = { .id =UCLASS_IRQ , .name ="irq" ,
drivers/misc/irq_sandbox.c +1 -1
@@ -43,7 +43,7 @@ static const struct irq_ops sandbox_irq_ops = { };static const struct udevice_id sandbox_irq_ids[] = { - { .compatible ="sandbox,irq" }, + { .compatible ="sandbox,irq" ,SANDBOX_IRQT_BASE }, { } };
include/irq.h +21 -0
@@ -8,6 +8,17 @@#ifndef __irq_H#define __irq_H +/* +* Interrupt controller types available. You can find a particular one with +* irq_first_device_type() +*/ +enum irq_dev_t { +X86_IRQT_BASE ,/* Base controller */ +X86_IRQT_ITSS ,/* ITSS controller, e.g. on APL */ +X86_IRQT_ACPI_GPE ,/* ACPI General-Purpose Events controller */ +SANDBOX_IRQT_BASE ,/* Sandbox testing */ +}; +/** * struct irq_ops - Operations for the IRQ */
@@ -85,4 +96,14 @@ int irq_snapshot_polarities(struct udevice *dev);*/ int irq_restore_polarities (struct udevice *dev); +/** +* irq_first_device_type() - Get a particular interrupt controller +* +* @type: Type to find +* @devp: Returns the device, if found +* @return 0 if OK, -ENODEV if not found, other -ve error if uclass failed to +* probe +*/ +int irq_first_device_type (enum irq_dev_t type,struct udevice **devp); +#endif
test/dm/irq.c +14 -0
@@ -8,6 +8,7 @@#include <common.h> #include <dm.h> #include <irq.h> +#include <asm/test.h> #include <dm/test.h> #include <test/ut.h>
@@ -30,3 +31,16 @@ static int dm_test_irq_base(struct unit_test_state *uts)return 0 ; }DM_TEST (dm_test_irq_base,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); + +/* Test of irq_first_device_type() */ +static int dm_test_irq_type (struct unit_test_state *uts) +{ +struct udevice *dev; + +ut_assertok (irq_first_device_type (SANDBOX_IRQT_BASE , &dev)); +ut_asserteq (-ENODEV ,irq_first_device_type (X86_IRQT_BASE , &dev)); + +return 0 ; +} +DM_TEST (dm_test_irq_type,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +
Signature · 1 line
2.24.1.735.g03f4e72817-goog
PATCH v2 5/13 dm: irq: Add support for interrupt controller types
Hi Simon,
Quoted 67 lines · Simon Glass
There can be different types of interrupt controllers in a system and some drivers may need to distinguish between these. In general this can be handled using the device tree by adding the interrupt information to device nodes.
However on x86 devices we have interrupt controllers which are not tied to any particular device and not really used in U-Boot. These still need to be inited, so a convenient method is to give each controller a type and allow a particular controller type to be probed.
Add support for this in sandbox along with a test.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
arch/sandbox/include/asm/test.h | 4 ++++ drivers/misc/irq-uclass.c | 24 +++++++++++++++++++++++- drivers/misc/irq_sandbox.c | 2 +- include/irq.h | 21 +++++++++++++++++++++ test/dm/irq.c | 14 ++++++++++++++ 5 files changed, 63 insertions(+), 2 deletions(-)arch/sandbox/include/asm/test.h +4
-0@@ -45,6 +45,10 @@#define PCI_EA_BAR2_MAGIC 0x72727272#define PCI_EA_BAR4_MAGIC 0x74747474 +enum { +SANDBOX_IRQN_PEND =1 ,/* Interrupt number for 'pending' test */ +}; +/* System controller driver data */ enum {SYSCON0 =32 ,drivers/misc/irq-uclass.c +7
-1@@ -1,11 +1,13 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Copyright (C) 2015, Bin Meng <[email protected]> +* Copyright 2019 Google, LLC +* Written by Simon Glass <[email protected]> */ #include <common.h> #include <dm.h> #include <irq.h> +#include <dm/device-internal.h> int irq_route_pmc_gpio_gpe (struct udevice *dev,uint pmc_gpe_num) {@@ -47,6 +49,26 @@ int irq_restore_polarities(struct udevice *dev)return ops->restore_polarities (dev); } +int irq_first_device_type (enum irq_dev_t type,struct udevice **devp) +{ +struct udevice *dev; +struct uclass *uc;
drivers/misc/irq-uclass.c int irq_restore_polarities(struct udevice *dev) · line 65
Quoted 10 lines
drivers/misc/irq-uclass.c +10
-0+int ret; + + ret =uclass_get (UCLASS_IRQ , &uc); +if (ret) +return ret; + uclass_foreach_dev(dev, uc) { +if (dev_get_driver_data (dev) == type) { + *devp = dev; + +return device_probe (dev);
The logic is generic and should not be limited to IRQ uclass. Maybe we should put this API in DM core, and name it as something like uclass_first_device_drvdata()?
Quoted 79 lines
drivers/misc/irq-uclass.c +6
-0+ } + } + +return -ENODEV ; +} +UCLASS_DRIVER (irq) = { .id =UCLASS_IRQ , .name ="irq" ,drivers/misc/irq_sandbox.c +1
-1@@ -43,7 +43,7 @@ static const struct irq_ops sandbox_irq_ops = { };static const struct udevice_id sandbox_irq_ids[] = { - { .compatible ="sandbox,irq" }, + { .compatible ="sandbox,irq" ,SANDBOX_IRQT_BASE }, { } };include/irq.h +21
-0@@ -8,6 +8,17 @@#ifndef __irq_H#define __irq_H +/* +* Interrupt controller types available. You can find a particular one with +* irq_first_device_type() +*/ +enum irq_dev_t { +X86_IRQT_BASE ,/* Base controller */ +X86_IRQT_ITSS ,/* ITSS controller, e.g. on APL */ +X86_IRQT_ACPI_GPE ,/* ACPI General-Purpose Events controller */ +SANDBOX_IRQT_BASE ,/* Sandbox testing */ +}; +/** * struct irq_ops - Operations for the IRQ */ @@ -85,4 +96,14 @@ int irq_snapshot_polarities(struct udevice *dev);*/ int irq_restore_polarities (struct udevice *dev); +/** +* irq_first_device_type() - Get a particular interrupt controller +* +* @type: Type to find +* @devp: Returns the device, if found +* @return 0 if OK, -ENODEV if not found, other -ve error if uclass failed to +* probe +*/ +int irq_first_device_type (enum irq_dev_t type,struct udevice **devp); +#endif test/dm/irq.c +5
-0@@ -8,6 +8,7 @@#include <common.h> #include <dm.h> #include <irq.h> +#include <asm/test.h> #include <dm/test.h> #include <test/ut.h> @@ -30,3 +31,16 @@ static int dm_test_irq_base(struct unit_test_state *uts)return 0 ; }DM_TEST (dm_test_irq_base,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); + +/* Test of irq_first_device_type() */ +static int dm_test_irq_type (struct unit_test_state *uts) +{
test/dm/irq.c static int dm_test_irq_base(struct unit_test_state *uts)
Quoted 10 lines
test/dm/irq.c +9
-1+struct udevice *dev; + +ut_assertok (irq_first_device_type (SANDBOX_IRQT_BASE , &dev)); +ut_asserteq (-ENODEV ,irq_first_device_type (X86_IRQT_BASE , &dev)); + +return 0 ; +} +DM_TEST (dm_test_irq_type,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); + --
Regards,
Bin
PATCH v2 6/13 x86: Give each driver an IRQ type
In reply to Simon GlassAdd an IRQ type to each driver and use irq_first_device_type() to find and probe the correct one.
---
Changes in v2: None
arch/x86/cpu/apollolake/fsp_s.c | 4 ++-- arch/x86/cpu/apollolake/itss.c | 2 +- arch/x86/cpu/i386/interrupt.c | 3 ++- arch/x86/cpu/irq.c | 3 ++- drivers/pinctrl/intel/pinctrl.c | 2 +- include/irq.h | 2 ++ 6 files changed, 10 insertions(+), 6 deletions(-)
arch/x86/cpu/apollolake/fsp_s.c +2 -2
@@ -535,7 +535,7 @@ int arch_fsps_preinit(void)struct udevice *itss;int ret; - ret =uclass_first_device_err (UCLASS_IRQ , &itss); + ret =irq_first_device_type (X86_IRQT_ITSS , &itss);if (ret)return log_msg_ret ("no itss" , ret);/*
@@ -576,7 +576,7 @@ int arch_fsp_init_r(void)if (ret)return ret; - ret =uclass_first_device_err (UCLASS_IRQ , &itss); + ret =irq_first_device_type (X86_IRQT_ITSS , &itss);if (ret)return log_msg_ret ("no itss" , ret);/* Restore GPIO IRQ polarities back to previous settings */
arch/x86/cpu/apollolake/itss.c +1 -1
@@ -199,7 +199,7 @@ static const struct irq_ops apl_itss_ops = { };static const struct udevice_id apl_itss_ids[] = { - { .compatible ="intel,apl-itss" }, + { .compatible ="intel,apl-itss" , .data =X86_IRQT_ITSS }, { } };
arch/x86/cpu/i386/interrupt.c +2 -1
@@ -13,6 +13,7 @@#include <common.h> #include <dm.h> #include <efi_loader.h> +#include <irq.h> #include <irq_func.h> #include <asm/control_regs.h> #include <asm/i8259.h>
@@ -262,7 +263,7 @@ int interrupt_init(void)int ret;/* Try to set up the interrupt router, but don't require one */ - ret =uclass_first_device_err (UCLASS_IRQ , &dev); + ret =irq_first_device_type (X86_IRQT_BASE , &dev);if (ret && ret != -ENODEV )return ret;
arch/x86/cpu/irq.c +2 -1
@@ -7,6 +7,7 @@#include <dm.h> #include <errno.h> #include <fdtdec.h> +#include <irq.h> #include <malloc.h> #include <asm/io.h> #include <asm/irq.h>
@@ -351,7 +352,7 @@ int irq_router_probe(struct udevice *dev) }static const struct udevice_id irq_router_ids[] = { - { .compatible ="intel,irq-router" }, + { .compatible ="intel,irq-router" , .data =X86_IRQT_BASE }, { } };
drivers/pinctrl/intel/pinctrl.c +1 -1
@@ -613,7 +613,7 @@ int intel_pinctrl_ofdata_to_platdata(struct udevice *dev,log_err ("Cannot find community for pid %d\n" , pplat->pid);return -EDOM ; } - ret =uclass_first_device_err (UCLASS_IRQ , &priv->itss); + ret =irq_first_device_type (X86_IRQT_ITSS , &priv->itss);if (ret)return log_msg_ret ("Cannot find ITSS" , ret); priv->comm = comm;
include/irq.h +2 -0
@@ -99,6 +99,8 @@ int irq_restore_polarities(struct udevice *dev);/** * irq_first_device_type() - Get a particular interrupt controller * +* On success this returns an activated interrupt device. +* * @type: Type to find * @devp: Returns the device, if found * @return 0 if OK, -ENODEV if not found, other -ve error if uclass failed to
Signature · 1 line
2.24.1.735.g03f4e72817-goog
PATCH v2 6/13 x86: Give each driver an IRQ type
Hi Simon,
Quoted 112 lines · Simon Glass
Add an IRQ type to each driver and use
irq_first_device_type()to find and probe the correct one.Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
arch/x86/cpu/apollolake/fsp_s.c | 4 ++-- arch/x86/cpu/apollolake/itss.c | 2 +- arch/x86/cpu/i386/interrupt.c | 3 ++- arch/x86/cpu/irq.c | 3 ++- drivers/pinctrl/intel/pinctrl.c | 2 +- include/irq.h | 2 ++ 6 files changed, 10 insertions(+), 6 deletions(-)arch/x86/cpu/apollolake/fsp_s.c +2
-2@@ -535,7 +535,7 @@ int arch_fsps_preinit(void)struct udevice *itss;int ret; - ret =uclass_first_device_err (UCLASS_IRQ , &itss); + ret =irq_first_device_type (X86_IRQT_ITSS , &itss);if (ret)return log_msg_ret ("no itss" , ret);/* @@ -576,7 +576,7 @@ int arch_fsp_init_r(void)if (ret)return ret; - ret =uclass_first_device_err (UCLASS_IRQ , &itss); + ret =irq_first_device_type (X86_IRQT_ITSS , &itss);if (ret)return log_msg_ret ("no itss" , ret);/* Restore GPIO IRQ polarities back to previous settings */ arch/x86/cpu/apollolake/itss.c +1
-1@@ -199,7 +199,7 @@ static const struct irq_ops apl_itss_ops = { };static const struct udevice_id apl_itss_ids[] = { - { .compatible ="intel,apl-itss" }, + { .compatible ="intel,apl-itss" , .data =X86_IRQT_ITSS }, { } };arch/x86/cpu/i386/interrupt.c +2
-1@@ -13,6 +13,7 @@#include <common.h> #include <dm.h> #include <efi_loader.h> +#include <irq.h> #include <irq_func.h> #include <asm/control_regs.h> #include <asm/i8259.h> @@ -262,7 +263,7 @@ int interrupt_init(void)int ret;/* Try to set up the interrupt router, but don't require one */ - ret =uclass_first_device_err (UCLASS_IRQ , &dev); + ret =irq_first_device_type (X86_IRQT_BASE , &dev);if (ret && ret != -ENODEV )return ret;arch/x86/cpu/irq.c +2
-1@@ -7,6 +7,7 @@#include <dm.h> #include <errno.h> #include <fdtdec.h> +#include <irq.h> #include <malloc.h> #include <asm/io.h> #include <asm/irq.h> @@ -351,7 +352,7 @@ int irq_router_probe(struct udevice *dev) }static const struct udevice_id irq_router_ids[] = { - { .compatible ="intel,irq-router" }, + { .compatible ="intel,irq-router" , .data =X86_IRQT_BASE }, { } };drivers/pinctrl/intel/pinctrl.c +1
-1@@ -613,7 +613,7 @@ int intel_pinctrl_ofdata_to_platdata(struct udevice *dev,log_err ("Cannot find community for pid %d\n" , pplat->pid);return -EDOM ; } - ret =uclass_first_device_err (UCLASS_IRQ , &priv->itss); + ret =irq_first_device_type (X86_IRQT_ITSS , &priv->itss);if (ret)return log_msg_ret ("Cannot find ITSS" , ret); priv->comm = comm;include/irq.h +0
-0
include/irq.h int irq_restore_polarities(struct udevice *dev); · line 102
Quoted 4 lines
include/irq.h +1
-0@@ -99,6 +99,8 @@ int irq_restore_polarities(struct udevice *dev);/** * irq_first_device_type() - Get a particular interrupt controller * +* On success this returns an activated interrupt device.
This change should be in the previous patch, where this new API was added.
include/irq.h int irq_restore_polarities(struct udevice *dev);
Quoted 5 lines
include/irq.h +1
-1+* * @type: Type to find * @devp: Returns the device, if found * @return 0 if OK, -ENODEV if not found, other -ve error if uclass failed to --
Regards,
Bin
PATCH v2 7/13 x86: itss: Add of-platdata support
In reply to Simon GlassAllow this driver to be used in TPL by setting up the interrupt type correctly.
---
Changes in v2: None
arch/x86/cpu/apollolake/itss.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/x86/cpu/apollolake/itss.c +10 -0
@@ -146,6 +146,15 @@ static int apl_route_pmc_gpio_gpe(struct udevice *dev, uint pmc_gpe_num)return -ENOENT ; } +static int apl_itss_bind (struct udevice *dev) +{ +/* This is not set with of-platdata, so set it manually */ +if (CONFIG_IS_ENABLED (OF_PLATDATA )) + dev->driver_data =X86_IRQT_ITSS ; + +return 0 ; +} +static int apl_itss_ofdata_to_platdata (struct udevice *dev) {struct apl_itss_priv *priv =dev_get_priv (dev);
@@ -208,6 +217,7 @@ U_BOOT_DRIVER(apl_itss_drv) = { .id = UCLASS_IRQ, .of_match = apl_itss_ids, .ops = &apl_itss_ops, + .bind = apl_itss_bind, .ofdata_to_platdata = apl_itss_ofdata_to_platdata, .platdata_auto_alloc_size = sizeof(struct apl_itss_platdata), .priv_auto_alloc_size = sizeof(struct apl_itss_priv),
Signature · 1 line
2.24.1.735.g03f4e72817-goog
PATCH v2 7/13 x86: itss: Add of-platdata support
Quoted 4 lines · Simon Glass
Allow this driver to be used in TPL by setting up the interrupt type correctly.
Quoted 8 lines
Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
arch/x86/cpu/apollolake/itss.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
PATCH v2 8/13 dm: irq: Add support for requesting interrupts
In reply to Simon GlassAt present driver model supports the IRQ uclass but there is no way to request a particular interrupt for a driver.
Add a mechanism, similar to clock and reset, to read the interrupts required by a device from the device tree and to request those interrupts.
U-Boot itself does not have interrupt-driven handlers, so just provide a means to read and clear an interrupt. This can be useful to handle peripherals which must use an interrupt to determine when data is available, for example.
Bring over the basic binding file as well, from Linux v5.4. Note that the older binding is not supported in U-Boot; the newer 'special form' must be used.
Add a simple test of the new functionality.
---
Changes in v2: None
arch/sandbox/dts/test.dts | 5 +- .../interrupt-controller/interrupts.txt | 131 ++++++++++++++++++ drivers/misc/irq-uclass.c | 116 ++++++++++++++++ drivers/misc/irq_sandbox.c | 41 ++++++ include/irq.h | 115 +++++++++++++++ test/dm/irq.c | 31 +++++ 6 files changed, 438 insertions(+), 1 deletion(-) create mode 100644 doc/device-tree-bindings/interrupt-controller/interrupts.txt
arch/sandbox/dts/test.dts +4 -1
@@ -93,6 +93,7 @@ <&gpio_b 9 0xc 3 2 1>; int-value = <1234>; uint-value = <(-1234)>; + interrupts-extended = <&irq 3 0>; }; junk {
@@ -353,8 +354,10 @@ vss-microvolts = <0>; }; - irq { + irq: irq { compatible = "sandbox,irq"; + interrupt-controller; + #interrupt-cells = <2>; }; lcd {
doc/device-tree-bindings/interrupt-controller/interrupts.txt new file +131 -0
131 lines not on this page · raw message
drivers/misc/irq-uclass.c +116 -0
130 lines not on this page · raw message
drivers/misc/irq_sandbox.c +41 -0
62 lines not on this page · raw message
include/irq.h +115 -0
135 lines not on this page · raw message
test/dm/irq.c +31 -0
@@ -44,3 +44,34 @@ static int dm_test_irq_type(struct unit_test_state *uts) }DM_TEST (dm_test_irq_type,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +/* Test of irq_read_and_clear() */ +static int dm_test_read_and_clear (struct unit_test_state *uts) +{ +struct irq irq; + +ut_assertok (irq_first_device_type (SANDBOX_IRQT_BASE , &irq.dev)); + irq.id =SANDBOX_IRQN_PEND ; +ut_asserteq (0 ,irq_read_and_clear (&irq)); +ut_asserteq (0 ,irq_read_and_clear (&irq)); +ut_asserteq (0 ,irq_read_and_clear (&irq)); +ut_asserteq (1 ,irq_read_and_clear (&irq)); +ut_asserteq (0 ,irq_read_and_clear (&irq)); + +return 0 ; +} +DM_TEST (dm_test_read_and_clear,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); + +/* Test of irq_request() */ +static int dm_test_request (struct unit_test_state *uts) +{ +struct udevice *dev; +struct irq irq; + +ut_assertok (uclass_first_device_err (UCLASS_TEST_FDT , &dev)); +ut_asserteq_str ("a-test" , dev->name); +ut_assertok (irq_get_by_index (dev,0 , &irq)); +ut_asserteq (3 , irq.id); + +return 0 ; +} +DM_TEST (dm_test_request,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT );
Signature · 1 line
2.24.1.735.g03f4e72817-goog
PATCH v2 8/13 dm: irq: Add support for requesting interrupts
Hi Simon,
Quoted 248 lines · Simon Glass
At present driver model supports the IRQ uclass but there is no way to request a particular interrupt for a driver.
Add a mechanism, similar to clock and reset, to read the interrupts required by a device from the device tree and to request those interrupts.
U-Boot itself does not have interrupt-driven handlers, so just provide a means to read and clear an interrupt. This can be useful to handle peripherals which must use an interrupt to determine when data is available, for example.
Bring over the basic binding file as well, from Linux v5.4. Note that the older binding is not supported in U-Boot; the newer 'special form' must be used.
Add a simple test of the new functionality.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
arch/sandbox/dts/test.dts | 5 +- .../interrupt-controller/interrupts.txt | 131 ++++++++++++++++++ drivers/misc/irq-uclass.c | 116 ++++++++++++++++ drivers/misc/irq_sandbox.c | 41 ++++++ include/irq.h | 115 +++++++++++++++ test/dm/irq.c | 31 +++++ 6 files changed, 438 insertions(+), 1 deletion(-) create mode 100644 doc/device-tree-bindings/interrupt-controller/interrupts.txtarch/sandbox/dts/test.dts +4
-1@@ -93,6 +93,7 @@ <&gpio_b 9 0xc 3 2 1>; int-value = <1234>; uint-value = <(-1234)>; + interrupts-extended = <&irq 3 0>; }; junk {@@ -353,8 +354,10 @@ vss-microvolts = <0>; }; - irq { + irq: irq { compatible = "sandbox,irq"; + interrupt-controller; + #interrupt-cells = <2>; }; lcd {doc/device-tree-bindings/interrupt-controller/interrupts.txt new file +131
-0@@ -0,0 +1,131 @@ +Specifying interrupt information for devices +============================================ + +1) Interrupt client nodes +------------------------- + +Nodes that describe devices which generate interrupts must contain an +"interrupts" property, an "interrupts-extended" property, or both. If both are +present, the latter should take precedence; the former may be provided simply +for compatibility with software that does not recognize the latter. These +properties contain a list of interrupt specifiers, one per output interrupt. The +format of the interrupt specifier is determined by the interrupt controller to +which the interrupts are routed; see section 2 below for details. + + Example: + interrupt-parent = <&intc1>; + interrupts = <5 0>, <6 0>; + +The "interrupt-parent" property is used to specify the controller to which +interrupts are routed and contains a single phandle referring to the interrupt +controller node. This property is inherited, so it may be specified in an +interrupt client node or in any of its parent nodes. Interrupts listed in the +"interrupts" property are always in reference to the node's interrupt parent. + +The "interrupts-extended" property is a special form; useful when a node needs +to reference multiple interrupt parents or a different interrupt parent than +the inherited one. Each entry in this property contains both the parent phandle +and the interrupt specifier. + + Example: + interrupts-extended = <&intc1 5 1>, <&intc2 1 0>; + +(NOTE: only this 'special form' is supported in U-Boot) + + +2) Interrupt controller nodes +----------------------------- + +A device is marked as an interrupt controller with the "interrupt-controller" +property. This is a empty, boolean property. An additional "#interrupt-cells" +property defines the number of cells needed to specify a single interrupt. + +It is the responsibility of the interrupt controller's binding to define the +length and format of the interrupt specifier. The following two variants are +commonly used: + + a) one cell + ----------- + The #interrupt-cells property is set to 1 and the single cell defines the + index of the interrupt within the controller. + + Example: + + vic: intc at 10140000 { + compatible = "arm,versatile-vic"; + interrupt-controller; + #interrupt-cells = <1>; + reg = <0x10140000 0x1000>; + }; + + sic: intc at 10003000 { + compatible = "arm,versatile-sic"; + interrupt-controller; + #interrupt-cells = <1>; + reg = <0x10003000 0x1000>; + interrupt-parent = <&vic>; + interrupts = <31>; /* Cascaded to vic */ + }; + + b) two cells + ------------ + The #interrupt-cells property is set to 2 and the first cell defines the + index of the interrupt within the controller, while the second cell is used + to specify any of the following flags: + - bits[3:0] trigger type and level flags + 1 = low-to-high edge triggered + 2 = high-to-low edge triggered + 4 = active high level-sensitive + 8 = active low level-sensitive + + Example: + + i2c at 7000c000 { + gpioext: gpio-adnp at 41 { + compatible = "ad,gpio-adnp"; + reg = <0x41>; + + interrupt-parent = <&gpio>; + interrupts = <160 1>; + + gpio-controller; + #gpio-cells = <1>; + + interrupt-controller; + #interrupt-cells = <2>; + + nr-gpios = <64>; + }; + + sx8634 at 2b { + compatible = "smtc,sx8634"; + reg = <0x2b>; + + interrupt-parent = <&gpioext>; + interrupts = <3 0x8>; + + #address-cells = <1>; + #size-cells = <0>; + + threshold = <0x40>; + sensitivity = <7>; + }; + }; + + +Example of special form (supported by U-Boot): + + acpi_gpe: general-purpose-events { + reg = <IOMAP_ACPI_BASE IOMAP_ACPI_SIZE>; + compatible = "intel,acpi-gpe"; + interrupt-controller; + #interrupt-cells = <2>; + }; + + tpm at 50 { + reg = <0x50>; + compatible = "google,cr50"; + u-boot,i2c-offset-len = <0>; + ready-gpio = <&gpio_n 28 GPIO_ACTIVE_LOW>; + interrupts-extended = <&acpi_gpe 0x3c 0>; + };drivers/misc/irq-uclass.c +38
-0@@ -4,8 +4,11 @@* Written by Simon Glass <[email protected]> */ +#define LOG_CATEGORY UCLASS_IRQ +#include <common.h> #include <dm.h> +#include <dt-structs.h> #include <irq.h> #include <dm/device-internal.h> @@ -49,6 +52,119 @@ int irq_restore_polarities(struct udevice *dev)return ops->restore_polarities (dev); } +int irq_read_and_clear (struct irq *irq) +{ +const struct irq_ops *ops =irq_get_ops (irq->dev); + +if (!ops->read_and_clear) +return -ENOSYS ; + +return ops->read_and_clear (irq); +} + +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +int irq_get_by_index_platdata (struct udevice *dev,int index, +struct phandle_1_arg *cells,struct irq *irq) +{ +int ret; + +if (index !=0 ) +return -ENOSYS ; + ret =uclass_get_device (UCLASS_IRQ ,0 , &irq->dev); +if (ret) +return ret; + irq->id = cells[0 ].arg[0 ]; + +return 0 ; +} +#else +static int irq_of_xlate_default (struct irq *irq, +struct ofnode_phandle_args *args) +{ +log_debug ("(irq=%p)\n" , irq); + +if (args->args_count >1 ) { +log_debug ("Invaild args_count: %d\n" , args->args_count); +return -EINVAL ; + }
drivers/misc/irq-uclass.c int irq_restore_polarities(struct udevice *dev) · line 99
Quoted 10 lines
drivers/misc/irq-uclass.c +10
-0+ +if (args->args_count) + irq->id = args->args[0 ]; +else + irq->id =0 ; + +return 0 ; +} + +static int irq_get_by_index_tail(int ret, ofnode node,
It's odd to pass the return value of some other functions to this function and check it here. Can we please remove ret, and check its value at where we get that?
Quoted 113 lines
drivers/misc/irq-uclass.c +68
-0+struct ofnode_phandle_args *args, + const char *list_name, int index, + struct irq *irq) +{ + struct udevice *dev_irq; +const struct irq_ops *ops; + +assert (irq); + irq->dev =NULL ; +if (ret) + goto err; + + ret =uclass_get_device_by_ofnode (UCLASS_IRQ , args->node, &dev_irq); +if (ret) { +log_debug ("uclass_get_device_by_ofnode failed: err=%d\n" , ret); +return ret; + } + + irq->dev = dev_irq; + + ops =irq_get_ops (dev_irq); + +if (ops->of_xlate) + ret = ops->of_xlate (irq, args); +else + ret =irq_of_xlate_default (irq, args); +if (ret) { +log_debug ("of_xlate() failed: %d\n" , ret); +return ret; + } + +return irq_request (dev_irq, irq); +err: +log_debug ("Node '%s', property '%s', failed to request IRQ index %d: %d\n" , +ofnode_get_name (node), list_name, index, ret); +return ret; +} + +int irq_get_by_index (struct udevice *dev,int index,struct irq *irq) +{ +struct ofnode_phandle_args args; +int ret; + + ret =dev_read_phandle_with_args (dev,"interrupts-extended" , +"#interrupt-cells" ,0 , index, &args); + +return irq_get_by_index_tail (ret,dev_ofnode (dev), &args, +"interrupts-extended" , index >0 , irq); +} +#endif /* OF_PLATDATA */ + +int irq_request (struct udevice *dev,struct irq *irq) +{ +const struct irq_ops *ops; + +log_debug ("(dev=%p, irq=%p)\n" , dev, irq); +if (!irq) +return 0 ; + ops =irq_get_ops (dev); + + irq->dev = dev; + +if (!ops->request) +return 0 ; + +return ops->request (irq); +} +int irq_first_device_type (enum irq_dev_t type,struct udevice **devp) {struct udevice *dev;drivers/misc/irq_sandbox.c +27
-0@@ -8,6 +8,18 @@#include <common.h> #include <dm.h> #include <irq.h> +#include <asm/test.h> + +/** +* struct sandbox_irq_priv - private data for this driver +* +* @count: Counts the number calls to the read_and_clear() method +* @pending: true if an interrupt is pending, else false +*/ +struct sandbox_irq_priv { +int count; +bool pending; +};static int sandbox_set_polarity (struct udevice *dev,uint irq,bool active_low) {@@ -35,11 +47,39 @@ static int sandbox_restore_polarities(struct udevice *dev)return 0 ; } +static int sandbox_irq_read_and_clear (struct irq *irq) +{ +struct sandbox_irq_priv *priv =dev_get_priv (irq->dev); + +if (irq->id !=SANDBOX_IRQN_PEND ) +return -EINVAL ; + priv->count++; +if (priv->pending) { + priv->pending = false; +return 1 ; + } + +if (!(priv->count %3 )) + priv->pending = true; +
drivers/misc/irq_sandbox.c static int sandbox_restore_polarities(struct udevice *dev) · line 74
Quoted 10 lines
drivers/misc/irq_sandbox.c +10
-0+return 0 ; +} + +static int sandbox_irq_of_xlate (struct irq *irq, +struct ofnode_phandle_args *args) +{ + irq->id = args->args[0 ]; + +return 0 ; +}
This
Quoted 189 lines
drivers/misc/irq_sandbox.c +4
-0+static const struct irq_ops sandbox_irq_ops = { .route_pmc_gpio_gpe = sandbox_route_pmc_gpio_gpe, .set_polarity = sandbox_set_polarity, .snapshot_polarities = sandbox_snapshot_polarities, .restore_polarities = sandbox_restore_polarities, + .read_and_clear = sandbox_irq_read_and_clear, + .of_xlate = sandbox_irq_of_xlate, };static const struct udevice_id sandbox_irq_ids[] = {@@ -52,4 +92,5 @@ U_BOOT_DRIVER(sandbox_irq_drv) = { .id = UCLASS_IRQ, .of_match = sandbox_irq_ids, .ops = &sandbox_irq_ops, + .priv_auto_alloc_size = sizeof(struct sandbox_irq_priv), };include/irq.h +115
-0@@ -19,8 +19,21 @@ enum irq_dev_t { SANDBOX_IRQT_BASE, /* Sandbox testing */ }; +/** +* struct irq - A single irq line handled by an interrupt controller +* +* @dev: IRQ device that handles this irq +* @id: ID to identify this irq with the device +*/ +struct irq { +struct udevice *dev; +ulong id; +}; +/** * struct irq_ops - Operations for the IRQ +* +* Each IRQ device can handle mulitple IRQ lines */ struct irq_ops {/** @@ -57,6 +70,55 @@ struct irq_ops {* @return 0 */ int (*restore_polarities)(struct udevice *dev); + +/** +* read_and_clear() - get the value of an interrupt and clear it +* +* Clears the interrupt if pending +* +* @irq: IRQ line +* @return 0 if interrupt is not pending, 1 if it was (and so has been +* cleared), -ve on error +*/ +int (*read_and_clear)(struct irq *irq); +/** +* of_xlate - Translate a client's device-tree (OF) irq specifier. +* +* The irq core calls this function as the first step in implementing +* a client's irq_get_by_*() call. +* +* If this function pointer is set to NULL, the irq core will use a +* default implementation, which assumes #interrupt-cells = <1>, and +* that the DT cell contains a simple integer irq ID. +* +* @irq: The irq struct to hold the translation result. +* @args: The irq specifier values from device tree. +* @return 0 if OK, or a negative error code. +*/ +int (*of_xlate)(struct irq *irq,struct ofnode_phandle_args *args); +/** +* request - Request a translated irq. +* +* The irq core calls this function as the second step in +* implementing a client's irq_get_by_*() call, following a successful +* xxx_xlate() call, or as the only step in implementing a client's +* irq_request() call. +* +* @irq: The irq struct to request; this has been fille in by +* a previoux xxx_xlate() function call, or by the caller +* of irq_request(). +* @return 0 if OK, or a negative error code. +*/ +int (*request)(struct irq *irq); +/** +* free - Free a previously requested irq. +* +* This is the implementation of the client irq_free() API. +* +* @irq: The irq to free. +* @return 0 if OK, or a negative error code. +*/ +int (*free)(struct irq *irq); };#define irq_get_ops (dev) ((struct irq_ops *)(dev)->driver->ops)@@ -96,6 +158,59 @@ int irq_snapshot_polarities(struct udevice *dev);*/ int irq_restore_polarities (struct udevice *dev); +/** +* read_and_clear() - get the value of an interrupt and clear it +* +* Clears the interrupt if pending +* +* @dev: IRQ device +* @return 0 if interrupt is not pending, 1 if it was (and so has been +* cleared), -ve on error +*/ +int irq_read_and_clear (struct irq *irq); + +/** +* irq_get_by_index - Get/request an irq by integer index. +* +* This looks up and requests an irq. The index is relative to the client +* device; each device is assumed to have n irqs associated with it somehow, +* and this function finds and requests one of them. The mapping of client +* device irq indices to provider irqs may be via device-tree +* properties, board-provided mapping tables, or some other mechanism. +* +* @dev: The client device. +* @index: The index of the irq to request, within the client's list of +* irqs. +* @irq: A pointer to a irq struct to initialise. +* @return 0 if OK, or a negative error code. +*/ +int irq_get_by_index (struct udevice *dev,int index,struct irq *irq); + +/** +* irq_request - Request a irq by provider-specific ID. +* +* This requests a irq using a provider-specific ID. Generally, this function +* should not be used, since irq_get_by_index/name() provide an interface that +* better separates clients from intimate knowledge of irq providers. +* However, this function may be useful in core SoC-specific code. +* +* @dev: The irq provider device. +* @irq: A pointer to a irq struct to initialise. The caller must +* have already initialised any field in this struct which the +* irq provider uses to identify the irq. +* @return 0 if OK, or a negative error code. +*/ +int irq_request (struct udevice *dev,struct irq *irq); + +/** +* irq_free - Free a previously requested irq. +* +* @irq: A irq struct that was previously successfully requested by +* irq_request/get_by_*(). +* @return 0 if OK, or a negative error code. +*/ +int irq_free (struct irq *irq); +/** * irq_first_device_type() - Get a particular interrupt controller * test/dm/irq.c +22
-0@@ -44,3 +44,34 @@ static int dm_test_irq_type(struct unit_test_state *uts) }DM_TEST (dm_test_irq_type,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); +/* Test of irq_read_and_clear() */ +static int dm_test_read_and_clear (struct unit_test_state *uts) +{ +struct irq irq; + +ut_assertok (irq_first_device_type (SANDBOX_IRQT_BASE , &irq.dev)); + irq.id =SANDBOX_IRQN_PEND ; +ut_asserteq (0 ,irq_read_and_clear (&irq)); +ut_asserteq (0 ,irq_read_and_clear (&irq)); +ut_asserteq (0 ,irq_read_and_clear (&irq)); +ut_asserteq (1 ,irq_read_and_clear (&irq)); +ut_asserteq (0 ,irq_read_and_clear (&irq)); + +return 0 ; +} +DM_TEST (dm_test_read_and_clear,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); + +/* Test of irq_request() */ +static int dm_test_request (struct unit_test_state *uts) +{ +struct udevice *dev; +struct irq irq;
test/dm/irq.c static int dm_test_irq_type(struct unit_test_state *uts)
Quoted 10 lines
test/dm/irq.c +9
-1+ +ut_assertok (uclass_first_device_err (UCLASS_TEST_FDT , &dev)); +ut_asserteq_str ("a-test" , dev->name); +ut_assertok (irq_get_by_index (dev,0 , &irq)); +ut_asserteq (3 , irq.id); + +return 0 ; +} +DM_TEST (dm_test_request,DM_TESTF_SCAN_PDATA |DM_TESTF_SCAN_FDT ); --
Regards,
Bin
PATCH v2 8/13 dm: irq: Add support for requesting interrupts
Hi Bin,
Quoted 36 lines · Bin Meng
Hi Simon,
Quoted 32 lines · Simon Glass
At present driver model supports the IRQ uclass but there is no way to request a particular interrupt for a driver.
Add a mechanism, similar to clock and reset, to read the interrupts required by a device from the device tree and to request those interrupts.
U-Boot itself does not have interrupt-driven handlers, so just provide a means to read and clear an interrupt. This can be useful to handle peripherals which must use an interrupt to determine when data is available, for example.
Bring over the basic binding file as well, from Linux v5.4. Note that the older binding is not supported in U-Boot; the newer 'special form' must be used.
Add a simple test of the new functionality.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
arch/sandbox/dts/test.dts | 5 +- .../interrupt-controller/interrupts.txt | 131 ++++++++++++++++++ drivers/misc/irq-uclass.c | 116 ++++++++++++++++ drivers/misc/irq_sandbox.c | 41 ++++++ include/irq.h | 115 +++++++++++++++ test/dm/irq.c | 31 +++++ 6 files changed, 438 insertions(+), 1 deletion(-) create mode 100644 doc/device-tree-bindings/interrupt-controller/interrupts.txt
[..]
Quoted 61 lines
Quoted 61 lines
drivers/misc/irq-uclass.c +44
-0@@ -4,8 +4,11 @@* Written by Simon Glass <[email protected]> */ +#define LOG_CATEGORY UCLASS_IRQ +#include <common.h> #include <dm.h> +#include <dt-structs.h> #include <irq.h> #include <dm/device-internal.h> @@ -49,6 +52,119 @@ int irq_restore_polarities(struct udevice *dev)return ops->restore_polarities (dev); } +int irq_read_and_clear (struct irq *irq) +{ +const struct irq_ops *ops =irq_get_ops (irq->dev); + +if (!ops->read_and_clear) +return -ENOSYS ; + +return ops->read_and_clear (irq); +} + +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +int irq_get_by_index_platdata (struct udevice *dev,int index, +struct phandle_1_arg *cells,struct irq *irq) +{ +int ret; + +if (index !=0 ) +return -ENOSYS ; + ret =uclass_get_device (UCLASS_IRQ ,0 , &irq->dev); +if (ret) +return ret; + irq->id = cells[0 ].arg[0 ]; + +return 0 ; +} +#else +static int irq_of_xlate_default (struct irq *irq, +struct ofnode_phandle_args *args) +{ +log_debug ("(irq=%p)\n" , irq); + +if (args->args_count >1 ) { +log_debug ("Invaild args_count: %d\n" , args->args_count); +return -EINVAL ; + } + +if (args->args_count) + irq->id = args->args[0 ]; +else + irq->id =0 ; +
Quoted 8 lines
drivers/misc/irq-uclass.c int irq_restore_polarities(struct udevice *dev) · line 99
Quoted 4 lines
drivers/misc/irq-uclass.c +4
-0+return 0 ; +} + +static int irq_get_by_index_tail(int ret, ofnode node,It's odd to pass the return value of some other functions to this function and check it here. Can we please remove ret, and check its value at where we get that?
This pattern is similar to how it is done in DM core. It routes all return paths through a single function where you can do error checking, etc. So I think this is better than the alternative. The only strange thing here is that this function is only used one. I did this since I suspected there would be others coming. But I could inline if it you like..
[..]
Quoted 9 lines
drivers/misc/irq-uclass.c int irq_restore_polarities(struct udevice *dev) · line 106
Quoted 7 lines
drivers/misc/irq-uclass.c +7
-0+static int sandbox_irq_of_xlate (struct irq *irq, +struct ofnode_phandle_args *args) +{ + irq->id = args->args[0 ]; + +return 0 ; +}This
...?
Regards,
Simon
PATCH v2 8/13 dm: irq: Add support for requesting interrupts
Hi Simon,
Quoted 112 lines · Simon Glass
Hi Bin,
Quoted 36 lines · Bin Meng
Hi Simon,
Quoted 32 lines · Simon Glass
At present driver model supports the IRQ uclass but there is no way to request a particular interrupt for a driver.
Add a mechanism, similar to clock and reset, to read the interrupts required by a device from the device tree and to request those interrupts.
U-Boot itself does not have interrupt-driven handlers, so just provide a means to read and clear an interrupt. This can be useful to handle peripherals which must use an interrupt to determine when data is available, for example.
Bring over the basic binding file as well, from Linux v5.4. Note that the older binding is not supported in U-Boot; the newer 'special form' must be used.
Add a simple test of the new functionality.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
arch/sandbox/dts/test.dts | 5 +- .../interrupt-controller/interrupts.txt | 131 ++++++++++++++++++ drivers/misc/irq-uclass.c | 116 ++++++++++++++++ drivers/misc/irq_sandbox.c | 41 ++++++ include/irq.h | 115 +++++++++++++++ test/dm/irq.c | 31 +++++ 6 files changed, 438 insertions(+), 1 deletion(-) create mode 100644 doc/device-tree-bindings/interrupt-controller/interrupts.txt[..]
Quoted 61 lines
Quoted 61 lines
drivers/misc/irq-uclass.c +44
-0@@ -4,8 +4,11 @@* Written by Simon Glass <[email protected]> */ +#define LOG_CATEGORY UCLASS_IRQ +#include <common.h> #include <dm.h> +#include <dt-structs.h> #include <irq.h> #include <dm/device-internal.h> @@ -49,6 +52,119 @@ int irq_restore_polarities(struct udevice *dev)return ops->restore_polarities (dev); } +int irq_read_and_clear (struct irq *irq) +{ +const struct irq_ops *ops =irq_get_ops (irq->dev); + +if (!ops->read_and_clear) +return -ENOSYS ; + +return ops->read_and_clear (irq); +} + +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +int irq_get_by_index_platdata (struct udevice *dev,int index, +struct phandle_1_arg *cells,struct irq *irq) +{ +int ret; + +if (index !=0 ) +return -ENOSYS ; + ret =uclass_get_device (UCLASS_IRQ ,0 , &irq->dev); +if (ret) +return ret; + irq->id = cells[0 ].arg[0 ]; + +return 0 ; +} +#else +static int irq_of_xlate_default (struct irq *irq, +struct ofnode_phandle_args *args) +{ +log_debug ("(irq=%p)\n" , irq); + +if (args->args_count >1 ) { +log_debug ("Invaild args_count: %d\n" , args->args_count); +return -EINVAL ; + } + +if (args->args_count) + irq->id = args->args[0 ]; +else + irq->id =0 ; +Quoted 8 lines
drivers/misc/irq-uclass.c int irq_restore_polarities(struct udevice *dev) · line 99
Quoted 4 lines
drivers/misc/irq-uclass.c +4
-0+return 0 ; +} + +static int irq_get_by_index_tail(int ret, ofnode node,It's odd to pass the return value of some other functions to this function and check it here. Can we please remove ret, and check its value at where we get that?
Quoted 6 lines
This pattern is similar to how it is done in DM core. It routes all return paths through a single function where you can do error checking, etc. So I think this is better than the alternative. The only strange thing here is that this function is only used one. I did this since I suspected there would be others coming. But I could inline if it you like..
If that's the way how other DM codes do, I am okay with that.
Quoted 13 lines
[..]
Quoted 9 lines
drivers/misc/irq-uclass.c
Quoted 7 lines
drivers/misc/irq-uclass.c +7
-0+static int sandbox_irq_of_xlate (struct irq *irq, +struct ofnode_phandle_args *args) +{ + irq->id = args->args[0 ]; + +return 0 ; +}This
Quoted 1 line
...?
I must have been working too long yesterday ...
Regards,
Bin
PATCH v2 9/13 x86: Add support for ACPI general-purpose events
In reply to Simon GlassACPI GPEs are used to signal interrupts from peripherals that are accessed via ACPI. In U-Boot these are modelled as interrupts using a separate interrupt controller. Configuration is via the device tree.
Add a simple driver for this.
---
Changes in v2: None
arch/x86/Kconfig | 33 +++++++ arch/x86/cpu/Makefile | 1 + arch/x86/cpu/acpi_gpe.c | 85 +++++++++++++++++++ .../interrupt-controller/intel,acpi-gpe.txt | 30 +++++++ 4 files changed, 149 insertions(+) create mode 100644 arch/x86/cpu/acpi_gpe.c create mode 100644 doc/device-tree-bindings/interrupt-controller/intel,acpi-gpe.txt
arch/x86/Kconfig +33 -0
@@ -910,4 +910,37 @@ config X86_OFFSET_SPL depends on SPL && X86 default SPL_TEXT_BASE +config ACPI_GPE + bool "Support ACPI general-purpose events" + help + Enable a driver for ACPI GPEs to allow peripherals to send interrupts + via ACPI to the OS. In U-Boot this is only used when U-Boot itself + needs access to these interrupts. This can happen when it uses a + peripheral that is set up to use GPEs and so cannot use the normal + GPIO mechanism for polling an input. + + See https://queue.acm.org/blogposting.cfm?id=18977 for more info + +config SPL_ACPI_GPE + bool "Support ACPI general-purpose events in SPL" + help + Enable a driver for ACPI GPEs to allow peripherals to send interrupts + via ACPI to the OS. In U-Boot this is only used when U-Boot itself + needs access to these interrupts. This can happen when it uses a + peripheral that is set up to use GPEs and so cannot use the normal + GPIO mechanism for polling an input. + + See https://queue.acm.org/blogposting.cfm?id=18977 for more info + +config TPL_ACPI_GPE + bool "Support ACPI general-purpose events in TPL" + help + Enable a driver for ACPI GPEs to allow peripherals to send interrupts + via ACPI to the OS. In U-Boot this is only used when U-Boot itself + needs access to these interrupts. This can happen when it uses a + peripheral that is set up to use GPEs and so cannot use the normal + GPIO mechanism for polling an input. + + See https://queue.acm.org/blogposting.cfm?id=18977 for more info + endmenu
arch/x86/cpu/Makefile +1 -0
@@ -55,6 +55,7 @@ obj-$(CONFIG_INTEL_QUEENSBAY) += queensbay/ obj-$(CONFIG_INTEL_TANGIER) += tangier/ obj-$(CONFIG_APIC) += lapic.o ioapic.o obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += irq.o +obj-$(CONFIG_$(SPL_TPL_)ACPI_GPE) += acpi_gpe.o obj-$(CONFIG_QFW) += qfw_cpu.o ifndef CONFIG_$(SPL_)X86_64 obj-$(CONFIG_SMP) += mp_init.o
arch/x86/cpu/acpi_gpe.c new file +85 -0
85 lines not on this page · raw message
doc/device-tree-bindings/interrupt-controller/intel,acpi-gpe.txt new file +30 -0
@@ -0,0 +1,30 @@ +* Intel Advanced Configuration and Power Interface General Purpose Events + +This describes an interrupt controller which provides access to GPEs supported +by the SoC. + +Required properties: + +- compatible : "intel,acpi-gpe" +- interrupt-controller : Identifies the node as an interrupt controller +- #interrupt-cells : The number of cells to define the interrupts. Must be 2: + cell 0: interrupt number (normally >=32 since GPEs below that are reserved) + cell 1: 0 (flags, but none are currently defined) +- reg : The register bank for the controller (set this to the ACPI base). + +Example: + + general-purpose-events { + reg = <IOMAP_ACPI_BASE IOMAP_ACPI_SIZE>; + compatible = "intel,acpi-gpe"; + interrupt-controller; + #interrupt-cells = <2>; + }; + + ... + tpm at 50 { + reg = <0x50>; + compatible = "google,cr50"; + ready-gpio = <&gpio_n 0x1c GPIO_ACTIVE_LOW>; + interrupts-extended = <&acpi_gpe 0x3c 0>; + };
Signature · 1 line
2.24.1.735.g03f4e72817-goog
PATCH v2 10/13 x86: coral: Add I2C and TPM device-tree definitions
In reply to Simon GlassAdd nodes to the device tree for Cr50 and other available I2C ports. Also enable the ACPI interrupt driver.
---
Changes in v2: None
arch/x86/cpu/apollolake/Kconfig | 1 + arch/x86/dts/chromebook_coral.dts | 87 +++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+)
arch/x86/cpu/apollolake/Kconfig +1 -0
@@ -42,6 +42,7 @@ config INTEL_APOLLOLAKE imply CLK imply CMD_CLK imply CLK_INTEL + imply ACPI_GPE if INTEL_APOLLOLAKE
arch/x86/dts/chromebook_coral.dts +87 -0
105 lines not on this page · raw message
Signature · 1 line
2.24.1.735.g03f4e72817-goog
PATCH v2 11/13 tpm: Add more TPM2 definitions
In reply to Simon GlassAdd definitions for access and status.
Need to drop the mixed case.
---
Changes in v2: None
include/tpm-v2.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
include/tpm-v2.h +31 -0
@@ -161,6 +161,37 @@ enum tpm_index_attrs { TPMA_NV_AUTHWRITE | TPMA_NV_POLICYWRITE, }; +enum { +TPM_ACCESS_VALID =1 <<7 , +TPM_ACCESS_ACTIVE_LOCALITY =1 <<5 , +TPM_ACCESS_REQUEST_PENDING =1 <<2 , +TPM_ACCESS_REQUEST_USE =1 <<1 , +TPM_ACCESS_ESTABLISHMENT =1 <<0 , +}; + +enum { +TPM_STS_FAMILY_SHIFT =26 , +TPM_STS_FAMILY_MASK =0x3 <<TPM_STS_FAMILY_SHIFT , +TPM_STS_FAMILY_TPM2 =1 <<TPM_STS_FAMILY_SHIFT , +TPM_STS_RESE_TESTABLISMENT_BIT =1 <<25 , +TPM_STS_COMMAND_CANCEL =1 <<24 , +TPM_STS_BURST_COUNT_SHIFT =8 , +TPM_STS_BURST_COUNT_MASK =0xffff <<TPM_STS_BURST_COUNT_SHIFT , +TPM_STS_VALID =1 <<7 , +TPM_STS_COMMAND_READY =1 <<6 , +TPM_STS_GO =1 <<5 , +TPM_STS_DATA_AVAIL =1 <<4 , +TPM_STS_DATA_EXPECT =1 <<3 , +TPM_STS_SELF_TEST_DONE =1 <<2 , +TPM_STS_RESPONSE_RETRY =1 <<1 , +}; + +enum { +TPM_CMD_COUNT_OFFSET =2 , +TPM_CMD_ORDINAL_OFFSET =6 , +TPM_MAX_BUF_SIZE =1260 , +}; +/** * Issue a TPM2_Startup command. *
Signature · 1 line
2.24.1.735.g03f4e72817-goog
PATCH v2 12/13 tpm: Add a driver for H1/Cr50
In reply to Simon GlassH1 is a Google security chip present in recent Chromebooks, Pixel phones and other devices. Cr50 is the name of the software that runs on H1 in Chromebooks.
This chip is used to handle TPM-like functionality and also has quite a few additional features.
Add a driver for this.
---
Changes in v2:
- Significant rewrite of cr50 init procedure
- Support use of interrupts
drivers/tpm/Kconfig | 10 + drivers/tpm/Makefile | 1 + drivers/tpm/cr50_i2c.c | 661 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 672 insertions(+) create mode 100644 drivers/tpm/cr50_i2c.c
drivers/tpm/Kconfig +10 -0
@@ -127,6 +127,16 @@ config TPM_V2 if TPM_V2 +config TPM2_CR50_I2C + bool "Enable support for Google cr50 TPM" + depends on DM_I2C + help + Cr50 is an implementation of a TPM on Google's H1 security chip. + This uses the same open-source firmware as the Chromium OS EC. + While Cr50 has other features, its primary role is as the root of + trust for a devuce, It operates like a TPM and can be used with + verified boot. Cr50 is used on recent Chromebooks (since 2017). + config TPM2_TIS_SANDBOX bool "Enable sandbox TPMv2.x driver" depends on TPM_V2 && SANDBOX
drivers/tpm/Makefile +1 -0
@@ -10,5 +10,6 @@ obj-$(CONFIG_TPM_TIS_SANDBOX) += tpm_tis_sandbox.o obj-$(CONFIG_TPM_ST33ZP24_I2C) += tpm_tis_st33zp24_i2c.o obj-$(CONFIG_TPM_ST33ZP24_SPI) += tpm_tis_st33zp24_spi.o +obj-$(CONFIG_TPM2_CR50_I2C) += cr50_i2c.o obj-$(CONFIG_TPM2_TIS_SANDBOX) += tpm2_tis_sandbox.o obj-$(CONFIG_TPM2_TIS_SPI) += tpm2_tis_spi.o
drivers/tpm/cr50_i2c.c new file +661 -0
661 lines not on this page · raw message
Signature · 1 line
2.24.1.735.g03f4e72817-goog
PATCH v2 12/13 tpm: Add a driver for H1/Cr50
Hi,
Quoted 17 lines · Simon Glass
H1 is a Google security chip present in recent Chromebooks, Pixel phones and other devices. Cr50 is the name of the software that runs on H1 in Chromebooks.
This chip is used to handle TPM-like functionality and also has quite a few additional features.
Add a driver for this.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Significant rewrite of cr50 init procedure
- Support use of interrupts
Quoted 5 lines
drivers/tpm/Kconfig | 10 + drivers/tpm/Makefile | 1 + drivers/tpm/cr50_i2c.c | 661 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 672 insertions(+) create mode 100644 drivers/tpm/cr50_i2c.c
I see that I did not make the timeout changes mentioned in the v1 patch.
I'm actually not sure they are an improvement.
Regards,
Simon
PATCH v2 13/13 x86: coral: Enable TPM
In reply to Simon GlassEnable TPM2 so that we can use cr50.
---
Changes in v2:
- Update the commit message
- Add new patches to handle requesting interrupts and interrupt state
configs/chromebook_coral_defconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
configs/chromebook_coral_defconfig +2 -1
@@ -54,7 +54,6 @@ CONFIG_CMD_TIME=y CONFIG_CMD_SOUND=y CONFIG_CMD_BOOTSTAGE=y CONFIG_CMD_TPM=y -CONFIG_CMD_TPM_TEST=y CONFIG_CMD_EXT2=y CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y
@@ -91,6 +90,8 @@ CONFIG_SPI=y CONFIG_ICH_SPI=y CONFIG_TPL_SYSRESET=y CONFIG_TPM_TIS_LPC=y +# CONFIG_TPM_V1 is not set +CONFIG_TPM2_CR50_I2C=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y
Signature · 1 line
2.24.1.735.g03f4e72817-goog