Message ID | 20180515095728.16572-27-miquel.raynal@bootlin.com |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
Series | Introduce TPMv2.0 support | expand |
On Tue, May 15, 2018 at 11:57:22AM +0200, Miquel Raynal wrote: > On some designs, the reset line could not be connected to the SoC reset > line, in this case, request the GPIO and ensure the chip gets reset. > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Tom Rini <trini@konsulko.com>
On 15 May 2018 at 19:57, Miquel Raynal <miquel.raynal@bootlin.com> wrote: > On some designs, the reset line could not be connected to the SoC reset > line, in this case, request the GPIO and ensure the chip gets reset. > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> > --- > drivers/tpm/tpm2_tis_spi.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) Reviewed-by: Simon Glass <sjg@chromium.org> Question below > > diff --git a/drivers/tpm/tpm2_tis_spi.c b/drivers/tpm/tpm2_tis_spi.c > index 6a4d5284c9..1c7f8f3673 100644 > --- a/drivers/tpm/tpm2_tis_spi.c > +++ b/drivers/tpm/tpm2_tis_spi.c > @@ -24,6 +24,9 @@ > #include <linux/compiler.h> > #include <linux/types.h> > #include <linux/unaligned/be_byteshift.h> > +#ifdef CONFIG_DM_GPIO > +#include <asm-generic/gpio.h> > +#endif > > #include "tpm_tis.h" > #include "tpm_internal.h" > @@ -574,6 +577,20 @@ static int tpm_tis_spi_probe(struct udevice *dev) > struct tpm_chip_priv *priv = dev_get_uclass_priv(dev); > struct tpm_chip *chip = dev_get_priv(dev); > int ret; > +#ifdef CONFIG_DM_GPIO Can this use if (IS_ENABLED(CONFIG_DM_GPIO)) ? It helps to improve build coverage. > + struct gpio_desc reset_gpio; > + > + ret = gpio_request_by_name(dev, "gpio-reset", 0, > + &reset_gpio, GPIOD_IS_OUT); > + if (ret) { > + log(LOGC_NONE, LOGL_NOTICE, "%s: missing reset GPIO\n", > + __func__); > + } else { > + dm_gpio_set_value(&reset_gpio, 0); > + mdelay(1); > + dm_gpio_set_value(&reset_gpio, 1); > + } > +#endif > > /* Ensure a minimum amount of time elapsed since reset of the TPM */ > mdelay(drv_data->time_before_first_cmd_ms); > -- > 2.14.1 >
Simon, Tom, On Wed, 16 May 2018 02:05:01 +1000, Simon Glass <sjg@chromium.org> wrote: > On 15 May 2018 at 19:57, Miquel Raynal <miquel.raynal@bootlin.com> wrote: > > On some designs, the reset line could not be connected to the SoC reset > > line, in this case, request the GPIO and ensure the chip gets reset. > > > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> > > --- > > drivers/tpm/tpm2_tis_spi.c | 17 +++++++++++++++++ > > 1 file changed, 17 insertions(+) > > Reviewed-by: Simon Glass <sjg@chromium.org> > > Question below > > > > > diff --git a/drivers/tpm/tpm2_tis_spi.c b/drivers/tpm/tpm2_tis_spi.c > > index 6a4d5284c9..1c7f8f3673 100644 > > --- a/drivers/tpm/tpm2_tis_spi.c > > +++ b/drivers/tpm/tpm2_tis_spi.c > > @@ -24,6 +24,9 @@ > > #include <linux/compiler.h> > > #include <linux/types.h> > > #include <linux/unaligned/be_byteshift.h> > > +#ifdef CONFIG_DM_GPIO > > +#include <asm-generic/gpio.h> > > +#endif > > > > #include "tpm_tis.h" > > #include "tpm_internal.h" > > @@ -574,6 +577,20 @@ static int tpm_tis_spi_probe(struct udevice *dev) > > struct tpm_chip_priv *priv = dev_get_uclass_priv(dev); > > struct tpm_chip *chip = dev_get_priv(dev); > > int ret; > > +#ifdef CONFIG_DM_GPIO > > Can this use if (IS_ENABLED(CONFIG_DM_GPIO)) ? > > It helps to improve build coverage. > Sure! Tom, I guess the series needs the following changes: - update the old license identifiers - two occurrences of "#ifdef CONFIG_DM_GPIO" in this patch to be replaced by "#if (IS_ENABLED(CONFIG_DM_GPIO))" I can either repost a new iteration of the whole series/just this patch or let you make the changes. Let me know what is best for you. Thanks you very much, both of you, for your guidance. Regards, Miquèl
On Tue, May 15, 2018 at 06:32:43PM +0200, Miquel Raynal wrote: > Simon, Tom, > > On Wed, 16 May 2018 02:05:01 +1000, Simon Glass <sjg@chromium.org> > wrote: > > > On 15 May 2018 at 19:57, Miquel Raynal <miquel.raynal@bootlin.com> wrote: > > > On some designs, the reset line could not be connected to the SoC reset > > > line, in this case, request the GPIO and ensure the chip gets reset. > > > > > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> > > > --- > > > drivers/tpm/tpm2_tis_spi.c | 17 +++++++++++++++++ > > > 1 file changed, 17 insertions(+) > > > > Reviewed-by: Simon Glass <sjg@chromium.org> > > > > Question below > > > > > > > > diff --git a/drivers/tpm/tpm2_tis_spi.c b/drivers/tpm/tpm2_tis_spi.c > > > index 6a4d5284c9..1c7f8f3673 100644 > > > --- a/drivers/tpm/tpm2_tis_spi.c > > > +++ b/drivers/tpm/tpm2_tis_spi.c > > > @@ -24,6 +24,9 @@ > > > #include <linux/compiler.h> > > > #include <linux/types.h> > > > #include <linux/unaligned/be_byteshift.h> > > > +#ifdef CONFIG_DM_GPIO > > > +#include <asm-generic/gpio.h> > > > +#endif > > > > > > #include "tpm_tis.h" > > > #include "tpm_internal.h" > > > @@ -574,6 +577,20 @@ static int tpm_tis_spi_probe(struct udevice *dev) > > > struct tpm_chip_priv *priv = dev_get_uclass_priv(dev); > > > struct tpm_chip *chip = dev_get_priv(dev); > > > int ret; > > > +#ifdef CONFIG_DM_GPIO > > > > Can this use if (IS_ENABLED(CONFIG_DM_GPIO)) ? > > > > It helps to improve build coverage. > > > > Sure! > > Tom, I guess the series needs the following changes: > - update the old license identifiers > - two occurrences of "#ifdef CONFIG_DM_GPIO" in this patch to be > replaced by "#if (IS_ENABLED(CONFIG_DM_GPIO))" > > I can either repost a new iteration of the whole series/just this patch > or let you make the changes. Let me know what is best for you. > > Thanks you very much, both of you, for your guidance. Just this patch is fine and thanks for iterating over it all!
diff --git a/drivers/tpm/tpm2_tis_spi.c b/drivers/tpm/tpm2_tis_spi.c index 6a4d5284c9..1c7f8f3673 100644 --- a/drivers/tpm/tpm2_tis_spi.c +++ b/drivers/tpm/tpm2_tis_spi.c @@ -24,6 +24,9 @@ #include <linux/compiler.h> #include <linux/types.h> #include <linux/unaligned/be_byteshift.h> +#ifdef CONFIG_DM_GPIO +#include <asm-generic/gpio.h> +#endif #include "tpm_tis.h" #include "tpm_internal.h" @@ -574,6 +577,20 @@ static int tpm_tis_spi_probe(struct udevice *dev) struct tpm_chip_priv *priv = dev_get_uclass_priv(dev); struct tpm_chip *chip = dev_get_priv(dev); int ret; +#ifdef CONFIG_DM_GPIO + struct gpio_desc reset_gpio; + + ret = gpio_request_by_name(dev, "gpio-reset", 0, + &reset_gpio, GPIOD_IS_OUT); + if (ret) { + log(LOGC_NONE, LOGL_NOTICE, "%s: missing reset GPIO\n", + __func__); + } else { + dm_gpio_set_value(&reset_gpio, 0); + mdelay(1); + dm_gpio_set_value(&reset_gpio, 1); + } +#endif /* Ensure a minimum amount of time elapsed since reset of the TPM */ mdelay(drv_data->time_before_first_cmd_ms);
On some designs, the reset line could not be connected to the SoC reset line, in this case, request the GPIO and ensure the chip gets reset. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> --- drivers/tpm/tpm2_tis_spi.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)