Thread (1 message) 1 message, 1 author, 2017-11-13

Re: [PATCH 1/2] can: flexcan: Remodel FlexCAN register r/w APIs for big endian FlexCAN controllers.

From: Marc Kleine-Budde <hidden>
Date: 2017-11-13 15:50:34
Also in: linux-can

On 11/10/2017 05:32 PM, Pankaj Bansal wrote:
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.
Please keep the endianess as default es stated in the comment in the driver:
quoted
/* Abstract off the read/write for arm versus ppc. This
 * assumes that PPC uses big-endian registers and everything
 * else uses little-endian registers, independent of CPU
 * endianness.
 */
See description of commit 0e4b949e6620 ("can: flexcan: fix flexcan
driver build for big endian on ARM and little endian on PowerPc") for
more information.

I'll not ACK a change in the driver, that's breaking PPC.

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   |

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help