All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pankaj Bansal <pankaj.bansal@nxp.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
	"wg@grandegger.com" <wg@grandegger.com>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Cc: Varun Sethi <V.Sethi@nxp.com>,
	Poonam Aggrwal <poonam.aggrwal@nxp.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: RE: [PATCH 1/2] can: flexcan: Remodel FlexCAN register r/w APIs for big endian FlexCAN controllers.
Date: Fri, 10 Nov 2017 16:32:11 +0000	[thread overview]
Message-ID: <AM0PR0402MB3940DE05B2BA456D0FF54498F1540@AM0PR0402MB3940.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <b27d6e14-c6d7-5c4b-0588-093684cbe57b@pengutronix.de>

Hi Marc,

Thanks for sharing the video and slides. It was really helpful.
But I would still like to solve this problem using device tree property.
My rationale behind it is that, if a platform designer uses same IP block whose support is present is linux kernel, but with different endianness.
Then he would not need to add his platform data in each driver to support his platform in linux.
He can just add endianness property in device tree and can use latest linux kernel right off the bat.
This is also mentioned in "Documentation/devicetree/bindings/regmap/regmap.txt".

Regmap defaults to little-endian register access on MMIO based
devices, this is by far the most common setting. On CPU
architectures that typically run big-endian operating systems
(e.g. PowerPC), registers can be defined as big-endian and must
be marked that way in the devicetree.

This rule was apparently not followed in P1010RDB flexcan node.

To solve this problem, I suggest that we define 2 optional device tree properties for flexcan.
little-endian : for powerpc architecture, if this property is defined then controller is little endian otherwise big endian (default)
big-endian : for other architectures, if this property is defined then controller is big endian otherwise little endian (default)

Although the controller drivers should be architecture independent, but apparently there is no way around it in flexcan.

let me know your thoughts.

Thanks & Regards,
Pankaj Bansal

-----Original Message-----
From: Marc Kleine-Budde [mailto:mkl@pengutronix.de] 
Sent: Friday, November 10, 2017 6:19 PM
To: Pankaj Bansal <pankaj.bansal@nxp.com>; wg@grandegger.com; linux-can@vger.kernel.org
Cc: Varun Sethi <V.Sethi@nxp.com>; Poonam Aggrwal <poonam.aggrwal@nxp.com>; devicetree@vger.kernel.org
Subject: Re: [PATCH 1/2] can: flexcan: Remodel FlexCAN register r/w APIs for big endian FlexCAN controllers.

On 11/10/2017 01:35 PM, Pankaj Bansal wrote:
>>> 3. Regarding backward compatibility with PowerPC, I see that there is only one platform in PowerPC architecture that is using flexcan.
>>>     There is only one platform in "arch/powerpc/boot/dts/" having flexcan node. p1010si-post.dtsi
>>>     I have added the big-endian property in that platform and have tested it on P1010 platform after backporting the patch to Freescale SDK 1.4 linux.
>>>     I have sent the patch for this. See "[PATCH 2/3] powerpc: dts: P1010: Add endianness property to flexcan node"
>>>     I believe these changes can be accepted for both powerpc and arm and other architectures that use flexcan.
>>
>> No, this is not acceptable. You break the device tree. Please add the le, be information to the devtype data.
> 
> I don't understand how this breaks device tree? can you please elaborate? This method is already being used in other specifications.

Boot a new kernel with an old tree on a PPC board -> flexcan will not work.

See this talk for more information for stable device tree ABI:

https://elinux.org/images/0/0e/OSELAS.Presentation-ELCE2017-DT.pdf
https://www.youtube.com/watch?v=6iguKSJJfxo

> You can refer "Documentation/devicetree/bindings/usb/usb-ehci.txt" or 
> "Documentation/devicetree/bindings/i2c/i2c-mux-reg.txt" Or 
> "Documentation/devicetree/bindings/regmap/regmap.txt".

> In my opinion, keeping this info in devtype data is not good idea.
> E.g. say two platforms which have same FlexCAN hardware revision, will 
> have same quirks. BUT these two platforms implement FlexCAN in le and 
> be fashion respectively.

Then it's two different platforms. Simply add another compatible to the driver.

> With current FlexCAN driver, these two platforms can have same devtype 
> data. And we need not to change flexcan.c if we want to add support 
> for a second platform. We can just add device tree for that platform 
> (which would be needed anyway), and it can work. We can mention 
> endianness in device tree.

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   |


  reply	other threads:[~2017-11-10 16:32 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10  9:59 [PATCH 1/2] can: flexcan: Remodel FlexCAN register r/w APIs for big endian FlexCAN controllers Pankaj Bansal
2017-11-10  9:59 ` [PATCH 2/2] can: flexcan: adding platform specific details for LS1021A Pankaj Bansal
2017-11-10 10:06 ` [PATCH 1/2] can: flexcan: Remodel FlexCAN register r/w APIs for big endian FlexCAN controllers Marc Kleine-Budde
2017-11-10 11:06   ` Pankaj Bansal
2017-11-10 11:09     ` Marc Kleine-Budde
2017-11-10 12:35       ` Pankaj Bansal
     [not found]         ` <AM0PR0402MB394051B0FAADBC45AF71439CF1540-mYCQpYF9suc3mfjNbz3WnI3W/0Ik+aLCnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-11-10 12:49           ` Marc Kleine-Budde
2017-11-10 16:32             ` Pankaj Bansal [this message]
     [not found]               ` <AM0PR0402MB3940DE05B2BA456D0FF54498F1540-mYCQpYF9suc3mfjNbz3WnI3W/0Ik+aLCnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-11-13 15:50                 ` Marc Kleine-Budde
2017-11-10 10:48 ` Marc Kleine-Budde
2017-11-14 11:56 ` [PATCH v2 " Pankaj Bansal
2017-11-14 11:56   ` [PATCH v2 2/2] can: flexcan: adding platform specific details for LS1021A Pankaj Bansal
2017-11-14 12:59     ` Marc Kleine-Budde
2017-11-16  5:34       ` Pankaj Bansal
2017-11-16  7:05         ` Wolfgang Grandegger
2017-11-16  7:23           ` ZHU Yi (ST-FIR/ENG1-Zhu)
2017-11-20 11:11             ` Pankaj Bansal
2017-11-21  2:13               ` ZHU Yi (ST-FIR/ENG1-Zhu)
2017-11-21  2:37                 ` Pankaj Bansal
2017-11-21  3:31                   ` ZHU Yi (ST-FIR/ENG1-Zhu)
2017-11-21 10:01                     ` Pankaj Bansal
2017-11-23  7:23                       ` ZHU Yi (ST-FIR/ENG1-Zhu)
2017-11-21 12:43                 ` Marc Kleine-Budde
2017-11-22  2:56                   ` ZHU Yi (ST-FIR/ENG1-Zhu)
2017-11-22  6:27                     ` Pankaj Bansal
2017-11-22 13:56                       ` Marc Kleine-Budde
2017-11-22 11:59                     ` Marc Kleine-Budde
2017-11-23  1:26                       ` ZHU Yi (ST-FIR/ENG1-Zhu)
     [not found]                       ` <CALw8SCUGuCmq+S_9-o-ZDYJuASveuj71WH97jYsEvNZX2N5ZXA@mail.gmail.com>
2017-11-23 20:17                         ` Mirza Krak
2017-11-23 21:05                           ` Wolfgang Grandegger
2017-11-24 16:02                             ` Mirza Krak
2017-11-24 19:19                               ` Wolfgang Grandegger
2017-11-26 21:11                                 ` Mirza Krak
2017-11-27 14:00                                   ` Marc Kleine-Budde
     [not found]                                     ` <CALw8SCVNqN0SM1e=bxXZFMVL0VN0iy0LgFj9Hv4BeRwAbb9Y6A@mail.gmail.com>
2017-11-28 22:11                                       ` Mirza Krak
2017-12-01 10:12                                         ` Mirza Krak
2017-12-01 10:32                                           ` Marc Kleine-Budde
2017-11-27 16:34                           ` Stefan Agner
2017-11-14 15:24   ` [PATCH v2 1/2] can: flexcan: Remodel FlexCAN register r/w APIs for big endian FlexCAN controllers Marc Kleine-Budde
2017-11-16  5:24     ` Pankaj Bansal
2017-11-16 12:04       ` Marc Kleine-Budde
2017-11-21 12:18     ` Pankaj Bansal
2017-11-21 12:38       ` Marc Kleine-Budde
2017-11-23  9:09   ` [PATCH v3 " Pankaj Bansal
2017-11-23  9:09     ` [PATCH v3 2/2] can: flexcan: adding platform specific details for LS1021A Pankaj Bansal
2017-11-23  9:16       ` Marc Kleine-Budde
2017-11-23 10:01         ` Pankaj Bansal
2017-11-23 10:07           ` Marc Kleine-Budde
2017-11-23 12:01             ` Pankaj Bansal
2017-11-23 12:33               ` Marc Kleine-Budde
2017-11-23  9:18     ` [PATCH v3 1/2] can: flexcan: Remodel FlexCAN register r/w APIs for big endian FlexCAN controllers Marc Kleine-Budde
2017-11-23  9:55       ` Pankaj Bansal

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=AM0PR0402MB3940DE05B2BA456D0FF54498F1540@AM0PR0402MB3940.eurprd04.prod.outlook.com \
    --to=pankaj.bansal@nxp.com \
    --cc=V.Sethi@nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=poonam.aggrwal@nxp.com \
    --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.