All of lore.kernel.org
 help / color / mirror / Atom feed
From: RICARD Christophe <christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Peter Huewe <PeterHuewe-Mmb7MZpHnFY@public.gmane.org>
Cc: ashley-fm2HMyfA2y6tG0bUXCXiUA@public.gmane.org,
	tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.org,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	christophe-h.ricard-qxv4g6HH51o@public.gmane.org,
	jean-luc.blanc-qxv4g6HH51o@public.gmane.org,
	benoit.houyere-qxv4g6HH51o@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org,
	jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org
Subject: Re: Aw: [PATCH v5 3/4] tpm/st33zp24/spi: Add st33zp24 spi phy
Date: Wed, 28 Jan 2015 20:13:33 +0100	[thread overview]
Message-ID: <54C934DD.2040109@gmail.com> (raw)
In-Reply-To: <trinity-1682f383-7165-419d-b9f7-ef1f205304d2-1422463682896@3capp-gmx-bs38>

Hi Peter,

A TPM command can be up to 2048 byte, A TPM response can be up to 1024 byte.
Between command and response, there are latency byte (up to 15 usually 
on st33zp24 2 are enough).

Overall when sending a command and expecting an answer we need in worst 
case:
2048 (for the TPM command) + 1024 (for the TPM answer).  We need some 
latency byte before the answer is available (max 15).
We have 2048 + 1024 + 15.

I will go for a define making the code more readable together with a 
comment.

Best Regards
Christophe
Le 28/01/2015 17:48, Peter Huewe a écrit :
> Hi Christophe,
>
> sorry to be nitty picky but I still don't get this calculation
>
>
> + /* max tpm tx buffer(TPM_BUFSIZE) + max tpm rx buffer(TPM_BUFSIZE / 2)
> + * + MAX_SPI_LATENCY.
> + */
> + phy->spi_xfer.tx_buf = devm_kmalloc(&dev->dev, (TPM_BUFSIZE +
> + (TPM_BUFSIZE / 2) + MAX_SPI_LATENCY),
> + GFP_KERNEL);
> + if (!phy->spi_xfer.tx_buf)
> + return -ENOMEM;
> +
> + phy->spi_xfer.rx_buf = devm_kmalloc(&dev->dev, (TPM_BUFSIZE +
> + (TPM_BUFSIZE / 2) + MAX_SPI_LATENCY),
> + GFP_KERNEL);
> + if (!phy->spi_xfer.rx_buf)
> + return -ENOMEM;
>   
>
> and the comment
> + /* max tpm tx buffer(TPM_BUFSIZE) + max tpm rx buffer(TPM_BUFSIZE / 2)
> + * + MAX_SPI_LATENCY.
> does not help either.
>
>
>
> Why do you define TPM_BUFSIZE as 2048, add TPM_BUFSIZE/2 and something called MAX_SPI_LATENCY to it to use it as your buffer size?
> Latency is for me something timing related.
>
> Since you use this TPM_BUFSIZE only in these two lines I'd be happy with either
> define which has this magical 2048+2014+15
> or (maybe better) add a reasonable comment describing the meaning of this strange calculation.
>
>
> Thanks,
> Peter

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-01-28 19:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-27 21:57 [PATCH v5 0/4] st33zp24 new architecture proposal and st33zp24 spi driver Christophe Ricard
     [not found] ` <1422395850-21644-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2015-01-27 21:57   ` [PATCH v5 1/4] tpm/tpm_i2c_stm_st33: Replace access to io_lpcpd from struct st33zp24_platform_data to tpm_stm_dev Christophe Ricard
2015-01-27 21:57   ` [PATCH v5 2/4] tpm/tpm_i2c_stm_st33: Split tpm_i2c_tpm_st33 in 2 layers (core + phy) Christophe Ricard
     [not found]     ` <1422395850-21644-3-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2015-01-28  6:34       ` Jarkko Sakkinen
2015-01-27 21:57   ` [PATCH v5 3/4] tpm/st33zp24/spi: Add st33zp24 spi phy Christophe Ricard
     [not found]     ` <1422395850-21644-4-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2015-01-28 16:48       ` Aw: " Peter Huewe
2015-01-28 19:13         ` RICARD Christophe [this message]
     [not found]           ` <54C934DD.2040109-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-01-28 20:36             ` Jason Gunthorpe
     [not found]               ` <20150128203625.GB10610-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-01-28 21:49                 ` peterhuewe-Mmb7MZpHnFY
     [not found]                   ` <78f08c37-9a15-4007-88f6-2c79ba113e6f-2ueSQiBKiTY7tOexoI0I+QC/G2K4zDHf@public.gmane.org>
2015-01-28 21:53                     ` Jason Gunthorpe
2015-01-27 21:57   ` [PATCH v5 4/4] tpm/st33zp24/dts/st33zp24-spi: Add dts documentation for " Christophe Ricard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54C934DD.2040109@gmail.com \
    --to=christophe.ricard-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=PeterHuewe-Mmb7MZpHnFY@public.gmane.org \
    --cc=ashley-fm2HMyfA2y6tG0bUXCXiUA@public.gmane.org \
    --cc=benoit.houyere-qxv4g6HH51o@public.gmane.org \
    --cc=christophe-h.ricard-qxv4g6HH51o@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=jean-luc.blanc-qxv4g6HH51o@public.gmane.org \
    --cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
    --cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.