> -----Original Message----- > From: Jason Gunthorpe <jgg@xxxxxxxxxx> > Sent: 28 February 2023 17:58 > To: Jarkko Sakkinen <jarkko@xxxxxxxxxx> > Cc: Krishna Yarlagadda <kyarlagadda@xxxxxxxxxx>; robh+dt@xxxxxxxxxx; > broonie@xxxxxxxxxx; peterhuewe@xxxxxx; > krzysztof.kozlowski+dt@xxxxxxxxxx; linux-spi@xxxxxxxxxxxxxxx; linux- > tegra@xxxxxxxxxxxxxxx; linux-integrity@xxxxxxxxxxxxxxx; linux- > kernel@xxxxxxxxxxxxxxx; thierry.reding@xxxxxxxxx; Jonathan Hunter > <jonathanh@xxxxxxxxxx>; Sowjanya Komatineni > <skomatineni@xxxxxxxxxx>; Laxman Dewangan <ldewangan@xxxxxxxxxx> > Subject: Re: [Patch V5 2/3] tpm_tis-spi: Support hardware wait polling > > On Tue, Feb 28, 2023 at 04:36:26AM +0200, Jarkko Sakkinen wrote: > > On Mon, Feb 27, 2023 at 05:37:01PM +0530, Krishna Yarlagadda wrote: > > > TPM devices raise wait signal on last addr cycle. This can be detected > > > by software driver by reading MISO line on same clock which requires > > > full duplex support. In case of half duplex controllers wait detection > > > has to be implemented in HW. > > > Support hardware wait state detection by sending entire message and let > > > controller handle flow control. > > > > When a is started sentence with the word "support" it translates to "I'm > > too lazy to write a proper and verbose description of the implementation" > > :-) > > > > It has some abstract ideas of the implementation, I give you that, but do > > you think anyone ever will get any value of reading that honestly? A bit > > more concrette description of the change helps e.g. when bisecting bugs. > > I would expect SPI_TPM_HW_FLOW to be documented in the kdocs to a > level that any other HW could implement it as well. HW implementation can be controller specific. I would add comments in the header to say CMD-ADDR-DATA is sent as single message with this flag. > > > > +int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len, > > > + u8 *in, const u8 *out) > > > +{ > > > + struct tpm_tis_spi_phy *phy = to_tpm_tis_spi_phy(data); > > > + struct spi_controller *ctlr = phy->spi_device->controller; > > > + > > > + /* > > > + * TPM flow control over SPI requires full duplex support. > > > + * Send entire message to a half duplex controller to handle > > > + * wait polling in controller. > > > + * Set TPM HW flow control flag.. > > > + */ > > > + if (ctlr->flags & SPI_CONTROLLER_HALF_DUPLEX) { > > > + phy->spi_device->mode |= SPI_TPM_HW_FLOW; > > Shouldn't we check that this special flow is supported when the SPI > device is bound to the tpm in the first place? TPM device connected behind half duplex controller can only work this way. So, no additional flag needed to check. KY > > Jason