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

ARM: dts: at91: sama5d2: add m_can nodes

Add nodes to support the Controller Area Network(M_CAN) on SAMA5D2.
The version of M_CAN IP core is 3.1.0 (CREL = 0x31040730).

As said in SAMA5D2 datasheet, the CAN clock is recommended to use
frequencies of 20, 40 or 80 MHz. To achieve these frequencies,
PMC GCLK3 must select the UPLLCK(480 MHz) as source clock and
divide by 24, 12, or 6. So, the "assigned-clock-rates" property
has three options: 20000000, 40000000, and 80000000.
The "assigned-clock-parents" property should be referred to utmi
fixedly.

The MSBs [bits 31:16] of the CAN Message RAM for CAN0 and CAN1 are
default configured in 0x00200000. To avoid conflict with SRAM map
for PM, change them to 0x00210000 in the AT91Bootstrap via setting
the CAN Memories Address-based Register(SFR_CAN) of SFR.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Tested-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

authored by

Wenyou Yang and committed by
Alexandre Belloni
bc6d5d76 43c3a448

+80
+24
arch/arm/boot/dts/at91-sama5d2_xplained.dts
··· 258 258 status = "okay"; 259 259 }; 260 260 261 + can0: can@f8054000 { 262 + pinctrl-names = "default"; 263 + pinctrl-0 = <&pinctrl_can0_default>; 264 + status = "okay"; 265 + }; 266 + 261 267 uart3: serial@fc008000 { 262 268 atmel,use-dma-rx; 263 269 atmel,use-dma-tx; ··· 325 319 */ 326 320 pinctrl_adc_default: adc_default { 327 321 pinmux = <PIN_PD23__GPIO>; 322 + bias-disable; 323 + }; 324 + 325 + pinctrl_can0_default: can0_default { 326 + pinmux = <PIN_PC10__CANTX0>, 327 + <PIN_PC11__CANRX0>; 328 + bias-disable; 329 + }; 330 + 331 + pinctrl_can1_default: can1_default { 332 + pinmux = <PIN_PC26__CANTX1>, 333 + <PIN_PC27__CANRX1>; 328 334 bias-disable; 329 335 }; 330 336 ··· 486 468 bias-disable; 487 469 }; 488 470 471 + }; 472 + 473 + can1: can@fc050000 { 474 + pinctrl-names = "default"; 475 + pinctrl-0 = <&pinctrl_can1_default>; 476 + status = "okay"; 489 477 }; 490 478 }; 491 479 };
+56
arch/arm/boot/dts/sama5d2.dtsi
··· 762 762 atmel,clk-output-range = <0 83000000>; 763 763 }; 764 764 765 + can0_clk: can0_clk { 766 + #clock-cells = <0>; 767 + reg = <56>; 768 + atmel,clk-output-range = <0 83000000>; 769 + }; 770 + 771 + can1_clk: can1_clk { 772 + #clock-cells = <0>; 773 + reg = <57>; 774 + atmel,clk-output-range = <0 83000000>; 775 + }; 776 + 765 777 classd_clk: classd_clk { 766 778 #clock-cells = <0>; 767 779 reg = <59>; ··· 901 889 i2s1_gclk: i2s1_gclk { 902 890 #clock-cells = <0>; 903 891 reg = <55>; 892 + }; 893 + 894 + can0_gclk: can0_gclk { 895 + #clock-cells = <0>; 896 + reg = <56>; 897 + atmel,clk-output-range = <0 80000000>; 898 + }; 899 + 900 + can1_gclk: can1_gclk { 901 + #clock-cells = <0>; 902 + reg = <57>; 903 + atmel,clk-output-range = <0 80000000>; 904 904 }; 905 905 }; 906 906 }; ··· 1168 1144 clocks = <&clk32k>; 1169 1145 }; 1170 1146 1147 + can0: can@f8054000 { 1148 + compatible = "bosch,m_can"; 1149 + reg = <0xf8054000 0x4000>, <0x210000 0x4000>; 1150 + reg-names = "m_can", "message_ram"; 1151 + interrupts = <56 IRQ_TYPE_LEVEL_HIGH 7>, 1152 + <64 IRQ_TYPE_LEVEL_HIGH 7>; 1153 + interrupt-names = "int0", "int1"; 1154 + clocks = <&can0_clk>, <&can0_gclk>; 1155 + clock-names = "hclk", "cclk"; 1156 + assigned-clocks = <&can0_gclk>; 1157 + assigned-clock-parents = <&utmi>; 1158 + assigned-clock-rates = <40000000>; 1159 + bosch,mram-cfg = <0x0 0 0 64 0 0 32 32>; 1160 + status = "disabled"; 1161 + }; 1162 + 1171 1163 spi1: spi@fc000000 { 1172 1164 compatible = "atmel,at91rm9200-spi"; 1173 1165 reg = <0xfc000000 0x100>; ··· 1343 1303 clocks = <&tdes_clk>; 1344 1304 clock-names = "tdes_clk"; 1345 1305 status = "okay"; 1306 + }; 1307 + 1308 + can1: can@fc050000 { 1309 + compatible = "bosch,m_can"; 1310 + reg = <0xfc050000 0x4000>, <0x210000 0x4000>; 1311 + reg-names = "m_can", "message_ram"; 1312 + interrupts = <57 IRQ_TYPE_LEVEL_HIGH 7>, 1313 + <65 IRQ_TYPE_LEVEL_HIGH 7>; 1314 + interrupt-names = "int0", "int1"; 1315 + clocks = <&can1_clk>, <&can1_gclk>; 1316 + clock-names = "hclk", "cclk"; 1317 + assigned-clocks = <&can1_gclk>; 1318 + assigned-clock-parents = <&utmi>; 1319 + assigned-clock-rates = <40000000>; 1320 + bosch,mram-cfg = <0x1100 0 0 64 0 0 32 32>; 1321 + status = "disabled"; 1346 1322 }; 1347 1323 1348 1324 sfrbu: sfr@fc05c000 {