From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Dong Aisheng <b29396@freescale.com>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>,
linux-can@vger.kernel.org, wg@grandegger.com,
devicetree@vger.kernel.org
Subject: Re: [PATCH 1/3] can: m_can: add Bosch M_CAN controller support
Date: Thu, 03 Jul 2014 11:20:27 +0200 [thread overview]
Message-ID: <53B5205B.2060206@pengutronix.de> (raw)
In-Reply-To: <20140703090957.GA26480@shlinux1.ap.freescale.net>
[-- Attachment #1: Type: text/plain, Size: 4104 bytes --]
On 07/03/2014 11:09 AM, Dong Aisheng wrote:
> On Thu, Jul 03, 2014 at 11:04:36AM +0200, Marc Kleine-Budde wrote:
>> On 07/03/2014 10:48 AM, Dong Aisheng wrote:
>>> On Thu, Jul 03, 2014 at 09:12:49AM +0200, Marc Kleine-Budde wrote:
>>>> On 07/03/2014 05:48 AM, Dong Aisheng wrote:
>>>>> On Wed, Jul 02, 2014 at 09:13:07PM +0200, Marc Kleine-Budde wrote:
>>>>>> On 07/02/2014 07:54 PM, Oliver Hartkopp wrote:
>>>>>>> I'm not really familiar with the naming concept in device trees.
>>>>>>>
>>>>>>> What is your opinion about the remarks below?
>>>>>>
>>>>>> The entries in the DT, at least on freescale baords, follow the naming
>>>>>> scheme of the reference manual. E.g. on the mx25 it's can1 and can2:
>>>>>>
>>>>>> can1: can@43f88000 { ... }
>>>>>> can2: can@43f8c000 { ... }
>>>>>>
>>>>>> And on the mx28, its:
>>>>>>
>>>>>> can0: can@80032000 { ... }
>>>>>> can1: can@80034000 { ... }
>>>>>>
>>>>>> Because the imx25 datasheet uses a "1" based counting scheme, while the
>>>>>> imx28 uses a "0" based one.
>>>>>>
>>>>>> So it's best practise to follow the naming and numbering scheme of the
>>>>>> hardware reference manual.....and if you have access to the
>>>>>> documentation of the m_can core, use clock names of the m_can core for
>>>>>> the clock-names property.
>>>>>>
>>>>>
>>>>> Based on my knowledge, device tree allows define phandle name according to
>>>>> the real device name of HW according spec while the device node name should
>>>>> be general(e.g can@80032000 rather than flexcan@80032000).
>>>>> For imx6sx, there are already following entries in
>>>>> arch/arm/boot/dts/imx6sx.dtsi
>>>>> flexcan1: can@02090000 {...}
>>>>> flexcan2: can@02094000 {...}
>>>>> So i'd prefer to define as:
>>>>> m_can1: canfd@020e8000 {...}
>>>>> m_can2: canfd@020f0000 {...}
>>>>>
>>>>>
>>>>> One problem is there're can alias already.
>>>>> aliases {
>>>>> can0 = &flexcan1;
>>>>> can1 = &flexcan2;
>>>>> ...
>>>>> }
>>>>> I'm not sure adding can2&can3 for mcan is properly:
>>>>> aliases {
>>>>> can0 = &flexcan1;
>>>>> can1 = &flexcan2;
>>>>> can2 = &m_can1;
>>>>> can3 = &m_can2;
>>>>> ...
>>>>> }
>>>>> Since the m_can driver does not need to use aliases,
>>>>> so i will not add them.
>>>>
>>>> IMHO It's fine too add the can{2,3} aliases to m_can, too.
>>>>
>>>
>>> I think the main problem for doing this way is that the meaning of id
>>> return by of_alias_get_id may be not persistent.
>>> e.g
>>> For MX6SX
>>> aliases {
>>> can0 = &flexcan1;
>>> can1 = &flexcan2;
>>> can2 = &m_can1;
>>> can3 = &m_can2;
>>> ...
>>> }
>>>
>>> For other platform, it could be:
>>> aliases {
>>> can0 = &m_can1;
>>> can1 = &m_can2;
>>> ...
>>> }
>>> It's hard for driver to use.
>>
>> The driver doesn't make use of it, does it?
>>
>>> And actually the M_CAN driver does not need to use the alias.
>>> So i wonder if it makes sense to add the alias for m_can devices
>>> like that.
>>
>> For example the imx53 has two different SPI units, in the alias section
>> we see:
>>
>> spi0 = &ecspi1;
>> spi1 = &ecspi2;
>> spi2 = &cspi;
>
> Thanks for the info.
> I'm not clear what's our purpose adding alias like this?
> Can you help explain it a bit?
You can use the alias in your dts to refer to the node instead of the
more complicate name. Further you bring a order to all devices of the
same type and you can make use of the number in the alias for other
purposes, which is however not used for CAN afaik.
> Do we need adding alias for all exist devices?
Have a look at the existing imx*.dtsi files. If there are already
aliases for a given device type, then it makes sense to add new devices
of that type to the alias aswell.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]
next prev parent reply other threads:[~2014-07-03 9:20 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-27 10:00 [PATCH 0/3] can: m_can: add Bosch M_CAN controller support Dong Aisheng
2014-06-27 10:00 ` [PATCH 1/3] " Dong Aisheng
2014-06-27 12:35 ` Mark Rutland
2014-06-30 8:03 ` Dong Aisheng
2014-06-27 18:03 ` Oliver Hartkopp
2014-06-30 8:26 ` Dong Aisheng
2014-07-02 17:54 ` Oliver Hartkopp
2014-07-02 19:13 ` Marc Kleine-Budde
2014-07-03 3:48 ` Dong Aisheng
2014-07-03 7:12 ` Marc Kleine-Budde
2014-07-03 8:48 ` Dong Aisheng
[not found] ` <20140703084803.GA11012-KgLukfWpBlCctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2014-07-03 9:04 ` Marc Kleine-Budde
2014-07-03 9:09 ` Dong Aisheng
2014-07-03 9:20 ` Marc Kleine-Budde [this message]
2014-07-03 10:39 ` Dong Aisheng
2014-07-01 10:29 ` Marc Kleine-Budde
2014-07-02 6:20 ` Dong Aisheng
2014-07-02 7:57 ` Marc Kleine-Budde
2014-07-02 6:33 ` Dong Aisheng
2014-07-01 10:33 ` Marc Kleine-Budde
2014-06-27 10:00 ` [PATCH 2/3] can: m_can: add bus error handling Dong Aisheng
2014-07-01 10:37 ` Marc Kleine-Budde
2014-07-02 6:31 ` Dong Aisheng
2014-06-27 10:00 ` [PATCH 3/3] can: m_can: add loopback and monitor mode support Dong Aisheng
2014-07-01 10:38 ` Marc Kleine-Budde
2014-07-02 6:32 ` Dong Aisheng
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=53B5205B.2060206@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=b29396@freescale.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-can@vger.kernel.org \
--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).