linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: Oliver Hartkopp <socketcan@hartkopp.net>,
	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 v3 2/2] CAN: CAN driver to support multiple CAN bus on SPI interface
Date: Thu, 03 Apr 2014 14:14:23 +0200	[thread overview]
Message-ID: <533D509F.4000908@denx.de> (raw)
In-Reply-To: <533D4DE7.5090408@hartkopp.net>

Hi Oliver,

On 03/04/2014 14:02, Oliver Hartkopp wrote:
> Hi Stefano,
> 
> two more remarks:
> 
>>> On 02.04.2014 09:18, Stefano Babic wrote:
>>>
>>>> +
>>>> +/* CFG message */
>>>> +struct msg_cfg_data {
>>>> +	u8	channel;
>>>> +	u8	enabled;
>>>> +	struct can_bittiming bt;
>>>> +} __packed;
> 
> When you transfer this structure via SPI.
> What are your assumptions about the host specifc byte order?
> 
> Does the SPI CAN adapter autodetect the host byte order?
> 

The general assumption (I am sure/hope this is described in the doc) is
that data are transferred in big-endian mode on the SPI-Bus. The driver
calls then cpu_to_be32() in spi_can_cfg() before putting the data on the
bus.

>> Only to check what is happening:
>>
>> 5: hcan2: <NOARP> mtu 16 qdisc noop state DOWN qlen 10
>>     link/can
>>     can state STOPPED restart-ms 0
>>     bitrate 0 sample-point 0.000
>>     tq 0 prop-seg 0 phase-seg1 0 phase-seg2 0 sjw 0
>>     clock 100000000
> 
> Ah - you also have a CAN clock :-)
> 
> 
>> Agree, it is the best way. I will add a SPI_MSG_GET_CFG to retrieve the
>> timing from the controller in probe(). In my case, the controller cannot
>> have different timing for each channel, but I agree the query must be
>> done for each channel, in case a microcontroller supports it.
> 
> Yep.
> 
> Just to make sure what is needed:
> 
>>>> +		priv->can.clock.freq = SLAVE_CLK_FREQ;
>>>> +		priv->can.bittiming_const = NULL;
>>>> +		priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK |
>>>> +			CAN_CTRLMODE_LISTENONLY	| CAN_CTRLMODE_3_SAMPLES;
> 
> These three controller specific settings - which are usually constant values
> in other CAN drivers - need to be provided by SPI_MSG_GET_CFG.

ok, got it (I hope). Time to work for V4...

Best regards,
Stefano


-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================

      reply	other threads:[~2014-04-03 12:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-02  7:18 [PATCH v3 0/2] Adding support for CAN busses via SPI interface Stefano Babic
2014-04-02  7:18 ` [PATCH v3 1/2] Add documentation for SPI to CAN driver Stefano Babic
2014-04-02  7:18 ` [PATCH v3 2/2] CAN: CAN driver to support multiple CAN bus on SPI interface Stefano Babic
2014-04-02 17:21   ` Oliver Hartkopp
2014-04-03  8:57     ` Stefano Babic
2014-04-03 12:02       ` Oliver Hartkopp
2014-04-03 12:14         ` Stefano Babic [this message]

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=533D509F.4000908@denx.de \
    --to=sbabic@denx.de \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=socketcan@hartkopp.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).