Skip to content

Commit 88054d7

Browse files
Romain Sioengehariprasath
Romain Sioen
authored andcommitted
device: sama7d65: Fix initial clock for can devices
Add CAN clock ids and modify initial clock for CAN devices in hw_postinit, preventing failed CAN initialisation modules in Linux. Signed-off-by: Romain Sioen <[email protected]> Signed-off-by: Hari Prasath Gujulan Elango <[email protected]>
1 parent e6d464e commit 88054d7

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

device/sama7d65/sama7d65.c

+21
Original file line numberDiff line numberDiff line change
@@ -1103,5 +1103,26 @@ void hw_postinit(void)
11031103
pmc_mck_cfg_set(0, mck0_prescaler,
11041104
AT91C_PMC_PRES | AT91C_PMC_MDIV | AT91C_PMC_CSS);
11051105
#endif
1106+
1107+
/*
1108+
* Change CAN GCLK source clock from SLW_CLK to MAIN_CLK
1109+
* because of timout issue at CAN initialisation in Linux.
1110+
* This allows CAN devices to be ready earlier in boot process.
1111+
*/
1112+
pmc_enable_generic_clock(AT91C_ID_MCAN0,
1113+
GCK_CSS_MAIN_CLK,
1114+
2);
1115+
pmc_enable_generic_clock(AT91C_ID_MCAN1,
1116+
GCK_CSS_MAIN_CLK,
1117+
2);
1118+
pmc_enable_generic_clock(AT91C_ID_MCAN2,
1119+
GCK_CSS_MAIN_CLK,
1120+
2);
1121+
pmc_enable_generic_clock(AT91C_ID_MCAN3,
1122+
GCK_CSS_MAIN_CLK,
1123+
2);
1124+
pmc_enable_generic_clock(AT91C_ID_MCAN4,
1125+
GCK_CSS_MAIN_CLK,
1126+
2);
11061127
}
11071128

include/arch/sama7d65.h

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
#define AT91C_ID_FLEXCOM9 43
3636
#define AT91C_ID_FLEXCOM10 44
3737

38+
#define AT91C_ID_MCAN0 58
39+
#define AT91C_ID_MCAN1 59
40+
#define AT91C_ID_MCAN2 60
41+
#define AT91C_ID_MCAN3 61
42+
#define AT91C_ID_MCAN4 62
43+
3844
#define AT91C_ID_QSPI0 73
3945
#define AT91C_ID_QSPI1 74
4046
#define AT91C_ID_SDMMC0 75

0 commit comments

Comments
 (0)