Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1445427

Re: [PATCH/RFC 4/6] spi: slave: Add SPI slave handler reporting boot up time

From Mark Brown <broonie@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH/RFC 4/6] spi: slave: Add SPI slave handler reporting boot up time
Date 2016-07-18 14:20 +0200
Message-ID <rWfGF-62e-25@gated-at.bofh.it> (permalink)
References <rMQHv-47X-3@gated-at.bofh.it> <rMQHv-47X-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, Jun 22, 2016 at 03:42:07PM +0200, Geert Uytterhoeven wrote:
> Add an SPI slave handler responding with the time of reception of the
> last SPI message.
> 
> This can be used by an external microcontroller as a dead man's switch.

The subject says boot up time, this says time of reception of the last
message.  Which is it?

> +static int spi_slave_time_send(struct spi_device *spi)
> +{
> +	__be32 msg[2];
> +	u32 rem_ns;
> +	u64 ts;
> +
> +	ts = local_clock();
> +	rem_ns = do_div(ts, 1000000000) / 1000;
> +
> +	msg[0] = cpu_to_be32(ts);
> +	msg[1] = cpu_to_be32(rem_ns);
> +
> +	return spi_write(spi, &msg, sizeof(msg));
> +}

Looks like uptime which is a third thing.

> +static int spi_slave_time_remove(struct spi_device *spi)
> +{
> +	struct spi_slave_time_priv *priv = spi_get_drvdata(spi);
> +
> +	/* FIXME Doesn't work, as spi_write() is blocked on a completion */
> +	kthread_stop(priv->thread);

spi_async()?  Still no cancellation on the actual operation but it
pushes it more inside the framework.

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH/RFC 4/6] spi: slave: Add SPI slave handler reporting boot  up time Mark Brown <broonie@kernel.org> - 2016-07-18 14:20 +0200

csiph-web