Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: dts: at91: sama5d2: fix CAN message ram offset and size

CAN0 and CAN1 instances share the same message ram configured
at 0x210000 on sama5d2 Linux systems.
According to current configuration of CAN0, we need 0x1c00 bytes
so that the CAN1 don't overlap its message ram:
64 x RX FIFO0 elements => 64 x 72 bytes
32 x TXE (TX Event FIFO) elements => 32 x 8 bytes
32 x TXB (TX Buffer) elements => 32 x 72 bytes
So a total of 7168 bytes (0x1C00).

Fix offset to match this needed size.
Make the CAN0 message ram ioremap match exactly this size so that is
easily understandable. Adapt CAN1 size accordingly.

Fixes: bc6d5d7666b7 ("ARM: dts: at91: sama5d2: add m_can nodes")
Reported-by: Dan Sneddon <dan.sneddon@microchip.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Tested-by: Cristian Birsan <cristian.birsan@microchip.com>
Cc: stable@vger.kernel.org # v4.13+
Link: https://lore.kernel.org/r/20201203091949.9015-1-nicolas.ferre@microchip.com

authored by

Nicolas Ferre and committed by
Alexandre Belloni
85b8350a 9b5dcc8d

+3 -3
+3 -3
arch/arm/boot/dts/sama5d2.dtsi
··· 725 725 726 726 can0: can@f8054000 { 727 727 compatible = "bosch,m_can"; 728 - reg = <0xf8054000 0x4000>, <0x210000 0x4000>; 728 + reg = <0xf8054000 0x4000>, <0x210000 0x1c00>; 729 729 reg-names = "m_can", "message_ram"; 730 730 interrupts = <56 IRQ_TYPE_LEVEL_HIGH 7>, 731 731 <64 IRQ_TYPE_LEVEL_HIGH 7>; ··· 1131 1131 1132 1132 can1: can@fc050000 { 1133 1133 compatible = "bosch,m_can"; 1134 - reg = <0xfc050000 0x4000>, <0x210000 0x4000>; 1134 + reg = <0xfc050000 0x4000>, <0x210000 0x3800>; 1135 1135 reg-names = "m_can", "message_ram"; 1136 1136 interrupts = <57 IRQ_TYPE_LEVEL_HIGH 7>, 1137 1137 <65 IRQ_TYPE_LEVEL_HIGH 7>; ··· 1141 1141 assigned-clocks = <&pmc PMC_TYPE_GCK 57>; 1142 1142 assigned-clock-parents = <&pmc PMC_TYPE_CORE PMC_UTMI>; 1143 1143 assigned-clock-rates = <40000000>; 1144 - bosch,mram-cfg = <0x1100 0 0 64 0 0 32 32>; 1144 + bosch,mram-cfg = <0x1c00 0 0 64 0 0 32 32>; 1145 1145 status = "disabled"; 1146 1146 }; 1147 1147