lkml.org 
[lkml]   [2016]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH/RFC 4/6] spi: slave: Add SPI slave handler reporting boot up time
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.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2016-07-18 15:01    [W:0.070 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site