All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Stefano Babic <sbabic@denx.de>, linux-can@vger.kernel.org
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
	Wolfgang Grandegger <wg@grandegger.com>
Subject: Re: [PATCH v5 2/2] CAN: CAN driver to support multiple CAN bus on SPI interface
Date: Wed, 29 Oct 2014 21:57:34 +0100	[thread overview]
Message-ID: <545154BE.8000603@hartkopp.net> (raw)
In-Reply-To: <1406565510-10783-3-git-send-email-sbabic@denx.de>

On 28.07.2014 18:38, Stefano Babic wrote:

> --- a/drivers/net/can/spi/Makefile
> +++ b/drivers/net/can/spi/Makefile
> @@ -4,5 +4,6 @@
>
>
>   obj-$(CONFIG_CAN_MCP251X)	+= mcp251x.o
> +obj-$(CONFIG_CAN_SPI)		+= spi_can.o
>
>   ccflags-$(CONFIG_CAN_DEBUG_DEVICES) := -DDEBUG

This ccflags stuff already has been remove - so it needs a tiny rebase here.
Sorry.

> diff --git a/drivers/net/can/spi/spi_can.c b/drivers/net/can/spi/spi_can.c
> new file mode 100644
> index 0000000..087e6b7
> --- /dev/null
> +++ b/drivers/net/can/spi/spi_can.c


> +struct msg_cfg_get_data {
> +	u8	channel;
> +	u8	tseg1_min;
> +	u8	tseg1_max;
> +	u8	tseg2_min;
> +	u8	tseg2_max;
> +	u8	sjw_max;
> +	u32	brp_min;
> +	u32	brp_max;
> +	u32	brp_inc;
> +	u8	ctrlmode;

u32 ?


> +static int spi_can_hwtstamp_ioctl(struct net_device *netdev,
> +			struct ifreq *ifr, int cmd)
> +{
> +	struct hwtstamp_config config;
> +
> +	if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
> +		return -EFAULT;
> +
> +	if (config.flags)
> +		return -EINVAL;
> +
> +	switch (config.tx_type) {
> +	case HWTSTAMP_TX_OFF:
> +		break;
> +	case HWTSTAMP_TX_ON:
> +		break;
> +	default:
> +		return -ERANGE;
> +	}
> +
> +	switch (config.rx_filter) {
> +	case HWTSTAMP_FILTER_NONE:
> +		break;
> +	default:
> +		config.rx_filter = HWTSTAMP_FILTER_ALL;
> +		break;
> +	}
> +
> +	return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
> +		-EFAULT : 0;
> +}
> +
> +static int spi_can_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
> +{
> +	if (!netif_running(dev))
> +		return -EINVAL;
> +
> +	if (cmd == SIOCSHWTSTAMP)
> +		return spi_can_hwtstamp_ioctl(dev, rq, cmd);
> +
> +	return -EINVAL;
> +}

What is this ioctl() intended for?

Can this be handled by the standard Linux configuration interface for hardware 
timestamping?


Finally I would like to ask you about IFF_ECHO support (again).
I know that you had some concerns about the SPI performance when putting the 
sent CAN frame into the SPI receive path.

But I would at least suggest to make the SPI message interface capable to 
support IFF_ECHO on the slave CPU. E.g. by sending some index (!=0) from an 
echo skb store to/from the slave to detect originated frames in the receive path.

The SPI slave should announce if it supports IFF_ECHO. And some 8 bit value 
which goes down to the slave and is received together with a CAN frame would 
help to detect local frames.

Probably we can also use the high nibble from the dlc for that.

Regards,
Oliver


  reply	other threads:[~2014-10-29 20:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-28 16:38 [PATCH v5 0/2] Adding support for CAN busses via SPI interface Stefano Babic
2014-07-28 16:38 ` [PATCH v5 1/2] Add documentation for SPI to CAN driver Stefano Babic
2014-10-29 20:33   ` Oliver Hartkopp
2014-10-30 16:21     ` Stefano Babic
2014-10-30 20:41       ` Oliver Hartkopp
2014-11-05 12:19   ` Marc Kleine-Budde
2014-11-06 13:48     ` Stefano Babic
2014-07-28 16:38 ` [PATCH v5 2/2] CAN: CAN driver to support multiple CAN bus on SPI interface Stefano Babic
2014-10-29 20:57   ` Oliver Hartkopp [this message]
2014-10-31 10:57     ` Stefano Babic
2014-10-31 18:23       ` Oliver Hartkopp
2014-11-05 13:15   ` Marc Kleine-Budde
2014-11-06 16:13     ` Stefano Babic
2014-08-07  8:06 ` [PATCH v5 0/2] Adding support for CAN busses via " Stefano Babic
2014-09-16 13:01   ` Stefano Babic
2014-10-21 12:25 ` Stefano Babic

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=545154BE.8000603@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=sbabic@denx.de \
    --cc=wg@grandegger.com \
    /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.