diff options
| -rw-r--r-- | Documentation/devicetree/bindings/clock/st,stm32-rcc.txt | 6 | ||||
| -rw-r--r-- | drivers/clk/clk-stm32f4.c | 307 | ||||
| -rw-r--r-- | include/dt-bindings/clock/stm32fx-clock.h | 7 |
3 files changed, 310 insertions, 10 deletions
diff --git a/Documentation/devicetree/bindings/clock/st,stm32-rcc.txt b/Documentation/devicetree/bindings/clock/st,stm32-rcc.txt index b240121d2ac9..cfa04b614d8a 100644 --- a/Documentation/devicetree/bindings/clock/st,stm32-rcc.txt +++ b/Documentation/devicetree/bindings/clock/st,stm32-rcc.txt | |||
| @@ -11,6 +11,8 @@ Required properties: | |||
| 11 | "st,stm32f42xx-rcc" | 11 | "st,stm32f42xx-rcc" |
| 12 | "st,stm32f469-rcc" | 12 | "st,stm32f469-rcc" |
| 13 | "st,stm32f746-rcc" | 13 | "st,stm32f746-rcc" |
| 14 | "st,stm32f769-rcc" | ||
| 15 | |||
| 14 | - reg: should be register base and length as documented in the | 16 | - reg: should be register base and length as documented in the |
| 15 | datasheet | 17 | datasheet |
| 16 | - #reset-cells: 1, see below | 18 | - #reset-cells: 1, see below |
| @@ -102,6 +104,10 @@ The secondary index is bound with the following magic numbers: | |||
| 102 | 28 CLK_I2C3 | 104 | 28 CLK_I2C3 |
| 103 | 29 CLK_I2C4 | 105 | 29 CLK_I2C4 |
| 104 | 30 CLK_LPTIMER (LPTimer1 clock) | 106 | 30 CLK_LPTIMER (LPTimer1 clock) |
| 107 | 31 CLK_PLL_SRC | ||
| 108 | 32 CLK_DFSDM1 | ||
| 109 | 33 CLK_ADFSDM1 | ||
| 110 | 34 CLK_F769_DSI | ||
| 105 | ) | 111 | ) |
| 106 | 112 | ||
| 107 | Example: | 113 | Example: |
diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c index cdaa567c8042..fdac33a9be2f 100644 --- a/drivers/clk/clk-stm32f4.c +++ b/drivers/clk/clk-stm32f4.c | |||
| @@ -300,6 +300,85 @@ static const struct stm32f4_gate_data stm32f746_gates[] __initconst = { | |||
| 300 | { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, | 300 | { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, |
| 301 | }; | 301 | }; |
| 302 | 302 | ||
| 303 | static const struct stm32f4_gate_data stm32f769_gates[] __initconst = { | ||
| 304 | { STM32F4_RCC_AHB1ENR, 0, "gpioa", "ahb_div" }, | ||
| 305 | { STM32F4_RCC_AHB1ENR, 1, "gpiob", "ahb_div" }, | ||
| 306 | { STM32F4_RCC_AHB1ENR, 2, "gpioc", "ahb_div" }, | ||
| 307 | { STM32F4_RCC_AHB1ENR, 3, "gpiod", "ahb_div" }, | ||
| 308 | { STM32F4_RCC_AHB1ENR, 4, "gpioe", "ahb_div" }, | ||
| 309 | { STM32F4_RCC_AHB1ENR, 5, "gpiof", "ahb_div" }, | ||
| 310 | { STM32F4_RCC_AHB1ENR, 6, "gpiog", "ahb_div" }, | ||
| 311 | { STM32F4_RCC_AHB1ENR, 7, "gpioh", "ahb_div" }, | ||
| 312 | { STM32F4_RCC_AHB1ENR, 8, "gpioi", "ahb_div" }, | ||
| 313 | { STM32F4_RCC_AHB1ENR, 9, "gpioj", "ahb_div" }, | ||
| 314 | { STM32F4_RCC_AHB1ENR, 10, "gpiok", "ahb_div" }, | ||
| 315 | { STM32F4_RCC_AHB1ENR, 12, "crc", "ahb_div" }, | ||
| 316 | { STM32F4_RCC_AHB1ENR, 18, "bkpsra", "ahb_div" }, | ||
| 317 | { STM32F4_RCC_AHB1ENR, 20, "dtcmram", "ahb_div" }, | ||
| 318 | { STM32F4_RCC_AHB1ENR, 21, "dma1", "ahb_div" }, | ||
| 319 | { STM32F4_RCC_AHB1ENR, 22, "dma2", "ahb_div" }, | ||
| 320 | { STM32F4_RCC_AHB1ENR, 23, "dma2d", "ahb_div" }, | ||
| 321 | { STM32F4_RCC_AHB1ENR, 25, "ethmac", "ahb_div" }, | ||
| 322 | { STM32F4_RCC_AHB1ENR, 26, "ethmactx", "ahb_div" }, | ||
| 323 | { STM32F4_RCC_AHB1ENR, 27, "ethmacrx", "ahb_div" }, | ||
| 324 | { STM32F4_RCC_AHB1ENR, 28, "ethmacptp", "ahb_div" }, | ||
| 325 | { STM32F4_RCC_AHB1ENR, 29, "otghs", "ahb_div" }, | ||
| 326 | { STM32F4_RCC_AHB1ENR, 30, "otghsulpi", "ahb_div" }, | ||
| 327 | |||
| 328 | { STM32F4_RCC_AHB2ENR, 0, "dcmi", "ahb_div" }, | ||
| 329 | { STM32F4_RCC_AHB2ENR, 1, "jpeg", "ahb_div" }, | ||
| 330 | { STM32F4_RCC_AHB2ENR, 4, "cryp", "ahb_div" }, | ||
| 331 | { STM32F4_RCC_AHB2ENR, 5, "hash", "ahb_div" }, | ||
| 332 | { STM32F4_RCC_AHB2ENR, 6, "rng", "pll48" }, | ||
| 333 | { STM32F4_RCC_AHB2ENR, 7, "otgfs", "pll48" }, | ||
| 334 | |||
| 335 | { STM32F4_RCC_AHB3ENR, 0, "fmc", "ahb_div", | ||
| 336 | CLK_IGNORE_UNUSED }, | ||
| 337 | { STM32F4_RCC_AHB3ENR, 1, "qspi", "ahb_div", | ||
| 338 | CLK_IGNORE_UNUSED }, | ||
| 339 | |||
| 340 | { STM32F4_RCC_APB1ENR, 0, "tim2", "apb1_mul" }, | ||
| 341 | { STM32F4_RCC_APB1ENR, 1, "tim3", "apb1_mul" }, | ||
| 342 | { STM32F4_RCC_APB1ENR, 2, "tim4", "apb1_mul" }, | ||
| 343 | { STM32F4_RCC_APB1ENR, 3, "tim5", "apb1_mul" }, | ||
| 344 | { STM32F4_RCC_APB1ENR, 4, "tim6", "apb1_mul" }, | ||
| 345 | { STM32F4_RCC_APB1ENR, 5, "tim7", "apb1_mul" }, | ||
| 346 | { STM32F4_RCC_APB1ENR, 6, "tim12", "apb1_mul" }, | ||
| 347 | { STM32F4_RCC_APB1ENR, 7, "tim13", "apb1_mul" }, | ||
| 348 | { STM32F4_RCC_APB1ENR, 8, "tim14", "apb1_mul" }, | ||
| 349 | { STM32F4_RCC_APB1ENR, 10, "rtcapb", "apb1_mul" }, | ||
| 350 | { STM32F4_RCC_APB1ENR, 11, "wwdg", "apb1_div" }, | ||
| 351 | { STM32F4_RCC_APB1ENR, 13, "can3", "apb1_div" }, | ||
| 352 | { STM32F4_RCC_APB1ENR, 14, "spi2", "apb1_div" }, | ||
| 353 | { STM32F4_RCC_APB1ENR, 15, "spi3", "apb1_div" }, | ||
| 354 | { STM32F4_RCC_APB1ENR, 16, "spdifrx", "apb1_div" }, | ||
| 355 | { STM32F4_RCC_APB1ENR, 25, "can1", "apb1_div" }, | ||
| 356 | { STM32F4_RCC_APB1ENR, 26, "can2", "apb1_div" }, | ||
| 357 | { STM32F4_RCC_APB1ENR, 27, "cec", "apb1_div" }, | ||
| 358 | { STM32F4_RCC_APB1ENR, 28, "pwr", "apb1_div" }, | ||
| 359 | { STM32F4_RCC_APB1ENR, 29, "dac", "apb1_div" }, | ||
| 360 | |||
| 361 | { STM32F4_RCC_APB2ENR, 0, "tim1", "apb2_mul" }, | ||
| 362 | { STM32F4_RCC_APB2ENR, 1, "tim8", "apb2_mul" }, | ||
| 363 | { STM32F4_RCC_APB2ENR, 7, "sdmmc2", "sdmux2" }, | ||
| 364 | { STM32F4_RCC_APB2ENR, 8, "adc1", "apb2_div" }, | ||
| 365 | { STM32F4_RCC_APB2ENR, 9, "adc2", "apb2_div" }, | ||
| 366 | { STM32F4_RCC_APB2ENR, 10, "adc3", "apb2_div" }, | ||
| 367 | { STM32F4_RCC_APB2ENR, 11, "sdmmc1", "sdmux1" }, | ||
| 368 | { STM32F4_RCC_APB2ENR, 12, "spi1", "apb2_div" }, | ||
| 369 | { STM32F4_RCC_APB2ENR, 13, "spi4", "apb2_div" }, | ||
| 370 | { STM32F4_RCC_APB2ENR, 14, "syscfg", "apb2_div" }, | ||
| 371 | { STM32F4_RCC_APB2ENR, 16, "tim9", "apb2_mul" }, | ||
| 372 | { STM32F4_RCC_APB2ENR, 17, "tim10", "apb2_mul" }, | ||
| 373 | { STM32F4_RCC_APB2ENR, 18, "tim11", "apb2_mul" }, | ||
| 374 | { STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" }, | ||
| 375 | { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, | ||
| 376 | { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, | ||
| 377 | { STM32F4_RCC_APB2ENR, 23, "sai2", "apb2_div" }, | ||
| 378 | { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, | ||
| 379 | { STM32F4_RCC_APB2ENR, 30, "mdio", "apb2_div" }, | ||
| 380 | }; | ||
| 381 | |||
| 303 | /* | 382 | /* |
| 304 | * This bitmask tells us which bit offsets (0..192) on STM32F4[23]xxx | 383 | * This bitmask tells us which bit offsets (0..192) on STM32F4[23]xxx |
| 305 | * have gate bits associated with them. Its combined hweight is 71. | 384 | * have gate bits associated with them. Its combined hweight is 71. |
| @@ -318,6 +397,10 @@ static const u64 stm32f746_gate_map[MAX_GATE_MAP] = { 0x000000f17ef417ffull, | |||
| 318 | 0x0000000000000003ull, | 397 | 0x0000000000000003ull, |
| 319 | 0x04f77f833e01c9ffull }; | 398 | 0x04f77f833e01c9ffull }; |
| 320 | 399 | ||
| 400 | static const u64 stm32f769_gate_map[MAX_GATE_MAP] = { 0x000000f37ef417ffull, | ||
| 401 | 0x0000000000000003ull, | ||
| 402 | 0x44F77F833E01EDFFull }; | ||
| 403 | |||
| 321 | static const u64 *stm32f4_gate_map; | 404 | static const u64 *stm32f4_gate_map; |
| 322 | 405 | ||
| 323 | static struct clk_hw **clks; | 406 | static struct clk_hw **clks; |
| @@ -1048,6 +1131,10 @@ static const char *rtc_parents[4] = { | |||
| 1048 | "no-clock", "lse", "lsi", "hse-rtc" | 1131 | "no-clock", "lse", "lsi", "hse-rtc" |
| 1049 | }; | 1132 | }; |
| 1050 | 1133 | ||
| 1134 | static const char *pll_src = "pll-src"; | ||
| 1135 | |||
| 1136 | static const char *pllsrc_parent[2] = { "hsi", NULL }; | ||
| 1137 | |||
| 1051 | static const char *dsi_parent[2] = { NULL, "pll-r" }; | 1138 | static const char *dsi_parent[2] = { NULL, "pll-r" }; |
| 1052 | 1139 | ||
| 1053 | static const char *lcd_parent[1] = { "pllsai-r-div" }; | 1140 | static const char *lcd_parent[1] = { "pllsai-r-div" }; |
| @@ -1072,6 +1159,9 @@ static const char *uart_parents2[4] = { "apb1_div", "sys", "hsi", "lse" }; | |||
| 1072 | 1159 | ||
| 1073 | static const char *i2c_parents[4] = { "apb1_div", "sys", "hsi", "no-clock" }; | 1160 | static const char *i2c_parents[4] = { "apb1_div", "sys", "hsi", "no-clock" }; |
| 1074 | 1161 | ||
| 1162 | static const char * const dfsdm1_src[] = { "apb2_div", "sys" }; | ||
| 1163 | static const char * const adsfdm1_parent[] = { "sai1_clk", "sai2_clk" }; | ||
| 1164 | |||
| 1075 | struct stm32_aux_clk { | 1165 | struct stm32_aux_clk { |
| 1076 | int idx; | 1166 | int idx; |
| 1077 | const char *name; | 1167 | const char *name; |
| @@ -1313,6 +1403,177 @@ static const struct stm32_aux_clk stm32f746_aux_clk[] = { | |||
| 1313 | }, | 1403 | }, |
| 1314 | }; | 1404 | }; |
| 1315 | 1405 | ||
| 1406 | static const struct stm32_aux_clk stm32f769_aux_clk[] = { | ||
| 1407 | { | ||
| 1408 | CLK_LCD, "lcd-tft", lcd_parent, ARRAY_SIZE(lcd_parent), | ||
| 1409 | NO_MUX, 0, 0, | ||
| 1410 | STM32F4_RCC_APB2ENR, 26, | ||
| 1411 | CLK_SET_RATE_PARENT | ||
| 1412 | }, | ||
| 1413 | { | ||
| 1414 | CLK_I2S, "i2s", i2s_parents, ARRAY_SIZE(i2s_parents), | ||
| 1415 | STM32F4_RCC_CFGR, 23, 1, | ||
| 1416 | NO_GATE, 0, | ||
| 1417 | CLK_SET_RATE_PARENT | ||
| 1418 | }, | ||
| 1419 | { | ||
| 1420 | CLK_SAI1, "sai1_clk", sai_parents, ARRAY_SIZE(sai_parents), | ||
| 1421 | STM32F4_RCC_DCKCFGR, 20, 3, | ||
| 1422 | STM32F4_RCC_APB2ENR, 22, | ||
| 1423 | CLK_SET_RATE_PARENT | ||
| 1424 | }, | ||
| 1425 | { | ||
| 1426 | CLK_SAI2, "sai2_clk", sai_parents, ARRAY_SIZE(sai_parents), | ||
| 1427 | STM32F4_RCC_DCKCFGR, 22, 3, | ||
| 1428 | STM32F4_RCC_APB2ENR, 23, | ||
| 1429 | CLK_SET_RATE_PARENT | ||
| 1430 | }, | ||
| 1431 | { | ||
| 1432 | NO_IDX, "pll48", pll48_parents, ARRAY_SIZE(pll48_parents), | ||
| 1433 | STM32F7_RCC_DCKCFGR2, 27, 1, | ||
| 1434 | NO_GATE, 0, | ||
| 1435 | 0 | ||
| 1436 | }, | ||
| 1437 | { | ||
| 1438 | NO_IDX, "sdmux1", sdmux_parents, ARRAY_SIZE(sdmux_parents), | ||
| 1439 | STM32F7_RCC_DCKCFGR2, 28, 1, | ||
| 1440 | NO_GATE, 0, | ||
| 1441 | 0 | ||
| 1442 | }, | ||
| 1443 | { | ||
| 1444 | NO_IDX, "sdmux2", sdmux_parents, ARRAY_SIZE(sdmux_parents), | ||
| 1445 | STM32F7_RCC_DCKCFGR2, 29, 1, | ||
| 1446 | NO_GATE, 0, | ||
| 1447 | 0 | ||
| 1448 | }, | ||
| 1449 | { | ||
| 1450 | CLK_HDMI_CEC, "hdmi-cec", | ||
| 1451 | hdmi_parents, ARRAY_SIZE(hdmi_parents), | ||
| 1452 | STM32F7_RCC_DCKCFGR2, 26, 1, | ||
| 1453 | NO_GATE, 0, | ||
| 1454 | 0 | ||
| 1455 | }, | ||
| 1456 | { | ||
| 1457 | CLK_SPDIF, "spdif-rx", | ||
| 1458 | spdif_parent, ARRAY_SIZE(spdif_parent), | ||
| 1459 | STM32F7_RCC_DCKCFGR2, 22, 3, | ||
| 1460 | STM32F4_RCC_APB2ENR, 23, | ||
| 1461 | CLK_SET_RATE_PARENT | ||
| 1462 | }, | ||
| 1463 | { | ||
| 1464 | CLK_USART1, "usart1", | ||
| 1465 | uart_parents1, ARRAY_SIZE(uart_parents1), | ||
| 1466 | STM32F7_RCC_DCKCFGR2, 0, 3, | ||
| 1467 | STM32F4_RCC_APB2ENR, 4, | ||
| 1468 | CLK_SET_RATE_PARENT, | ||
| 1469 | }, | ||
| 1470 | { | ||
| 1471 | CLK_USART2, "usart2", | ||
| 1472 | uart_parents2, ARRAY_SIZE(uart_parents1), | ||
| 1473 | STM32F7_RCC_DCKCFGR2, 2, 3, | ||
| 1474 | STM32F4_RCC_APB1ENR, 17, | ||
| 1475 | CLK_SET_RATE_PARENT, | ||
| 1476 | }, | ||
| 1477 | { | ||
| 1478 | CLK_USART3, "usart3", | ||
| 1479 | uart_parents2, ARRAY_SIZE(uart_parents1), | ||
| 1480 | STM32F7_RCC_DCKCFGR2, 4, 3, | ||
| 1481 | STM32F4_RCC_APB1ENR, 18, | ||
| 1482 | CLK_SET_RATE_PARENT, | ||
| 1483 | }, | ||
| 1484 | { | ||
| 1485 | CLK_UART4, "uart4", | ||
| 1486 | uart_parents2, ARRAY_SIZE(uart_parents1), | ||
| 1487 | STM32F7_RCC_DCKCFGR2, 6, 3, | ||
| 1488 | STM32F4_RCC_APB1ENR, 19, | ||
| 1489 | CLK_SET_RATE_PARENT, | ||
| 1490 | }, | ||
| 1491 | { | ||
| 1492 | CLK_UART5, "uart5", | ||
| 1493 | uart_parents2, ARRAY_SIZE(uart_parents1), | ||
| 1494 | STM32F7_RCC_DCKCFGR2, 8, 3, | ||
| 1495 | STM32F4_RCC_APB1ENR, 20, | ||
| 1496 | CLK_SET_RATE_PARENT, | ||
| 1497 | }, | ||
| 1498 | { | ||
| 1499 | CLK_USART6, "usart6", | ||
| 1500 | uart_parents1, ARRAY_SIZE(uart_parents1), | ||
| 1501 | STM32F7_RCC_DCKCFGR2, 10, 3, | ||
| 1502 | STM32F4_RCC_APB2ENR, 5, | ||
| 1503 | CLK_SET_RATE_PARENT, | ||
| 1504 | }, | ||
| 1505 | { | ||
| 1506 | CLK_UART7, "uart7", | ||
| 1507 | uart_parents2, ARRAY_SIZE(uart_parents1), | ||
| 1508 | STM32F7_RCC_DCKCFGR2, 12, 3, | ||
| 1509 | STM32F4_RCC_APB1ENR, 30, | ||
| 1510 | CLK_SET_RATE_PARENT, | ||
| 1511 | }, | ||
| 1512 | { | ||
| 1513 | CLK_UART8, "uart8", | ||
| 1514 | uart_parents2, ARRAY_SIZE(uart_parents1), | ||
| 1515 | STM32F7_RCC_DCKCFGR2, 14, 3, | ||
| 1516 | STM32F4_RCC_APB1ENR, 31, | ||
| 1517 | CLK_SET_RATE_PARENT, | ||
| 1518 | }, | ||
| 1519 | { | ||
| 1520 | CLK_I2C1, "i2c1", | ||
| 1521 | i2c_parents, ARRAY_SIZE(i2c_parents), | ||
| 1522 | STM32F7_RCC_DCKCFGR2, 16, 3, | ||
| 1523 | STM32F4_RCC_APB1ENR, 21, | ||
| 1524 | CLK_SET_RATE_PARENT, | ||
| 1525 | }, | ||
| 1526 | { | ||
| 1527 | CLK_I2C2, "i2c2", | ||
| 1528 | i2c_parents, ARRAY_SIZE(i2c_parents), | ||
| 1529 | STM32F7_RCC_DCKCFGR2, 18, 3, | ||
| 1530 | STM32F4_RCC_APB1ENR, 22, | ||
| 1531 | CLK_SET_RATE_PARENT, | ||
| 1532 | }, | ||
| 1533 | { | ||
| 1534 | CLK_I2C3, "i2c3", | ||
| 1535 | i2c_parents, ARRAY_SIZE(i2c_parents), | ||
| 1536 | STM32F7_RCC_DCKCFGR2, 20, 3, | ||
| 1537 | STM32F4_RCC_APB1ENR, 23, | ||
| 1538 | CLK_SET_RATE_PARENT, | ||
| 1539 | }, | ||
| 1540 | { | ||
| 1541 | CLK_I2C4, "i2c4", | ||
| 1542 | i2c_parents, ARRAY_SIZE(i2c_parents), | ||
| 1543 | STM32F7_RCC_DCKCFGR2, 22, 3, | ||
| 1544 | STM32F4_RCC_APB1ENR, 24, | ||
| 1545 | CLK_SET_RATE_PARENT, | ||
| 1546 | }, | ||
| 1547 | { | ||
| 1548 | CLK_LPTIMER, "lptim1", | ||
| 1549 | lptim_parent, ARRAY_SIZE(lptim_parent), | ||
| 1550 | STM32F7_RCC_DCKCFGR2, 24, 3, | ||
| 1551 | STM32F4_RCC_APB1ENR, 9, | ||
| 1552 | CLK_SET_RATE_PARENT | ||
| 1553 | }, | ||
| 1554 | { | ||
| 1555 | CLK_F769_DSI, "dsi", | ||
| 1556 | dsi_parent, ARRAY_SIZE(dsi_parent), | ||
| 1557 | STM32F7_RCC_DCKCFGR2, 0, 1, | ||
| 1558 | STM32F4_RCC_APB2ENR, 27, | ||
| 1559 | CLK_SET_RATE_PARENT | ||
| 1560 | }, | ||
| 1561 | { | ||
| 1562 | CLK_DFSDM1, "dfsdm1", | ||
| 1563 | dfsdm1_src, ARRAY_SIZE(dfsdm1_src), | ||
| 1564 | STM32F4_RCC_DCKCFGR, 25, 1, | ||
| 1565 | STM32F4_RCC_APB2ENR, 29, | ||
| 1566 | CLK_SET_RATE_PARENT | ||
| 1567 | }, | ||
| 1568 | { | ||
| 1569 | CLK_ADFSDM1, "adfsdm1", | ||
| 1570 | adsfdm1_parent, ARRAY_SIZE(adsfdm1_parent), | ||
| 1571 | STM32F4_RCC_DCKCFGR, 26, 1, | ||
| 1572 | STM32F4_RCC_APB2ENR, 29, | ||
| 1573 | CLK_SET_RATE_PARENT | ||
| 1574 | }, | ||
| 1575 | }; | ||
| 1576 | |||
| 1316 | static const struct stm32f4_clk_data stm32f429_clk_data = { | 1577 | static const struct stm32f4_clk_data stm32f429_clk_data = { |
| 1317 | .end_primary = END_PRIMARY_CLK, | 1578 | .end_primary = END_PRIMARY_CLK, |
| 1318 | .gates_data = stm32f429_gates, | 1579 | .gates_data = stm32f429_gates, |
| @@ -1343,6 +1604,16 @@ static const struct stm32f4_clk_data stm32f746_clk_data = { | |||
| 1343 | .aux_clk_num = ARRAY_SIZE(stm32f746_aux_clk), | 1604 | .aux_clk_num = ARRAY_SIZE(stm32f746_aux_clk), |
| 1344 | }; | 1605 | }; |
| 1345 | 1606 | ||
| 1607 | static const struct stm32f4_clk_data stm32f769_clk_data = { | ||
| 1608 | .end_primary = END_PRIMARY_CLK_F7, | ||
| 1609 | .gates_data = stm32f769_gates, | ||
| 1610 | .gates_map = stm32f769_gate_map, | ||
| 1611 | .gates_num = ARRAY_SIZE(stm32f769_gates), | ||
| 1612 | .pll_data = stm32f469_pll, | ||
| 1613 | .aux_clk = stm32f769_aux_clk, | ||
| 1614 | .aux_clk_num = ARRAY_SIZE(stm32f769_aux_clk), | ||
| 1615 | }; | ||
| 1616 | |||
| 1346 | static const struct of_device_id stm32f4_of_match[] = { | 1617 | static const struct of_device_id stm32f4_of_match[] = { |
| 1347 | { | 1618 | { |
| 1348 | .compatible = "st,stm32f42xx-rcc", | 1619 | .compatible = "st,stm32f42xx-rcc", |
| @@ -1356,6 +1627,10 @@ static const struct of_device_id stm32f4_of_match[] = { | |||
| 1356 | .compatible = "st,stm32f746-rcc", | 1627 | .compatible = "st,stm32f746-rcc", |
| 1357 | .data = &stm32f746_clk_data | 1628 | .data = &stm32f746_clk_data |
| 1358 | }, | 1629 | }, |
| 1630 | { | ||
| 1631 | .compatible = "st,stm32f769-rcc", | ||
| 1632 | .data = &stm32f769_clk_data | ||
| 1633 | }, | ||
| 1359 | {} | 1634 | {} |
| 1360 | }; | 1635 | }; |
| 1361 | 1636 | ||
| @@ -1427,9 +1702,8 @@ static void __init stm32f4_rcc_init(struct device_node *np) | |||
| 1427 | int n; | 1702 | int n; |
| 1428 | const struct of_device_id *match; | 1703 | const struct of_device_id *match; |
| 1429 | const struct stm32f4_clk_data *data; | 1704 | const struct stm32f4_clk_data *data; |
| 1430 | unsigned long pllcfgr; | ||
| 1431 | const char *pllsrc; | ||
| 1432 | unsigned long pllm; | 1705 | unsigned long pllm; |
| 1706 | struct clk_hw *pll_src_hw; | ||
| 1433 | 1707 | ||
| 1434 | base = of_iomap(np, 0); | 1708 | base = of_iomap(np, 0); |
| 1435 | if (!base) { | 1709 | if (!base) { |
| @@ -1460,21 +1734,33 @@ static void __init stm32f4_rcc_init(struct device_node *np) | |||
| 1460 | 1734 | ||
| 1461 | hse_clk = of_clk_get_parent_name(np, 0); | 1735 | hse_clk = of_clk_get_parent_name(np, 0); |
| 1462 | dsi_parent[0] = hse_clk; | 1736 | dsi_parent[0] = hse_clk; |
| 1737 | pllsrc_parent[1] = hse_clk; | ||
| 1463 | 1738 | ||
| 1464 | i2s_in_clk = of_clk_get_parent_name(np, 1); | 1739 | i2s_in_clk = of_clk_get_parent_name(np, 1); |
| 1465 | 1740 | ||
| 1466 | i2s_parents[1] = i2s_in_clk; | 1741 | i2s_parents[1] = i2s_in_clk; |
| 1467 | sai_parents[2] = i2s_in_clk; | 1742 | sai_parents[2] = i2s_in_clk; |
| 1468 | 1743 | ||
| 1744 | if (of_device_is_compatible(np, "st,stm32f769-rcc")) { | ||
| 1745 | clk_hw_register_gate(NULL, "dfsdm1_apb", "apb2_div", 0, | ||
| 1746 | base + STM32F4_RCC_APB2ENR, 29, | ||
| 1747 | CLK_IGNORE_UNUSED, &stm32f4_clk_lock); | ||
| 1748 | dsi_parent[0] = pll_src; | ||
| 1749 | sai_parents[3] = pll_src; | ||
| 1750 | } | ||
| 1751 | |||
| 1469 | clks[CLK_HSI] = clk_hw_register_fixed_rate_with_accuracy(NULL, "hsi", | 1752 | clks[CLK_HSI] = clk_hw_register_fixed_rate_with_accuracy(NULL, "hsi", |
| 1470 | NULL, 0, 16000000, 160000); | 1753 | NULL, 0, 16000000, 160000); |
| 1471 | 1754 | ||
| 1472 | pllcfgr = readl(base + STM32F4_RCC_PLLCFGR); | 1755 | pll_src_hw = clk_hw_register_mux(NULL, pll_src, pllsrc_parent, |
| 1473 | pllsrc = pllcfgr & BIT(22) ? hse_clk : "hsi"; | 1756 | ARRAY_SIZE(pllsrc_parent), 0, |
| 1474 | pllm = pllcfgr & 0x3f; | 1757 | base + STM32F4_RCC_PLLCFGR, 22, 1, 0, |
| 1758 | &stm32f4_clk_lock); | ||
| 1759 | |||
| 1760 | pllm = readl(base + STM32F4_RCC_PLLCFGR) & 0x3f; | ||
| 1475 | 1761 | ||
| 1476 | clk_hw_register_fixed_factor(NULL, "vco_in", pllsrc, | 1762 | clk_hw_register_fixed_factor(NULL, "vco_in", pll_src, |
| 1477 | 0, 1, pllm); | 1763 | 0, 1, pllm); |
| 1478 | 1764 | ||
| 1479 | stm32f4_rcc_register_pll("vco_in", &data->pll_data[0], | 1765 | stm32f4_rcc_register_pll("vco_in", &data->pll_data[0], |
| 1480 | &stm32f4_clk_lock); | 1766 | &stm32f4_clk_lock); |
| @@ -1612,12 +1898,16 @@ static void __init stm32f4_rcc_init(struct device_node *np) | |||
| 1612 | clks[aux_clk->idx] = hw; | 1898 | clks[aux_clk->idx] = hw; |
| 1613 | } | 1899 | } |
| 1614 | 1900 | ||
| 1615 | if (of_device_is_compatible(np, "st,stm32f746-rcc")) | 1901 | if (of_device_is_compatible(np, "st,stm32f746-rcc")) { |
| 1616 | 1902 | ||
| 1617 | clk_hw_register_fixed_factor(NULL, "hsi_div488", "hsi", 0, | 1903 | clk_hw_register_fixed_factor(NULL, "hsi_div488", "hsi", 0, |
| 1618 | 1, 488); | 1904 | 1, 488); |
| 1619 | 1905 | ||
| 1906 | clks[CLK_PLL_SRC] = pll_src_hw; | ||
| 1907 | } | ||
| 1908 | |||
| 1620 | of_clk_add_hw_provider(np, stm32f4_rcc_lookup_clk, NULL); | 1909 | of_clk_add_hw_provider(np, stm32f4_rcc_lookup_clk, NULL); |
| 1910 | |||
| 1621 | return; | 1911 | return; |
| 1622 | fail: | 1912 | fail: |
| 1623 | kfree(clks); | 1913 | kfree(clks); |
| @@ -1626,3 +1916,4 @@ fail: | |||
| 1626 | CLK_OF_DECLARE_DRIVER(stm32f42xx_rcc, "st,stm32f42xx-rcc", stm32f4_rcc_init); | 1916 | CLK_OF_DECLARE_DRIVER(stm32f42xx_rcc, "st,stm32f42xx-rcc", stm32f4_rcc_init); |
| 1627 | CLK_OF_DECLARE_DRIVER(stm32f46xx_rcc, "st,stm32f469-rcc", stm32f4_rcc_init); | 1917 | CLK_OF_DECLARE_DRIVER(stm32f46xx_rcc, "st,stm32f469-rcc", stm32f4_rcc_init); |
| 1628 | CLK_OF_DECLARE_DRIVER(stm32f746_rcc, "st,stm32f746-rcc", stm32f4_rcc_init); | 1918 | CLK_OF_DECLARE_DRIVER(stm32f746_rcc, "st,stm32f746-rcc", stm32f4_rcc_init); |
| 1919 | CLK_OF_DECLARE_DRIVER(stm32f769_rcc, "st,stm32f769-rcc", stm32f4_rcc_init); | ||
diff --git a/include/dt-bindings/clock/stm32fx-clock.h b/include/dt-bindings/clock/stm32fx-clock.h index 58d8b515be55..7d34e297049c 100644 --- a/include/dt-bindings/clock/stm32fx-clock.h +++ b/include/dt-bindings/clock/stm32fx-clock.h | |||
| @@ -54,7 +54,10 @@ | |||
| 54 | #define CLK_I2C3 28 | 54 | #define CLK_I2C3 28 |
| 55 | #define CLK_I2C4 29 | 55 | #define CLK_I2C4 29 |
| 56 | #define CLK_LPTIMER 30 | 56 | #define CLK_LPTIMER 30 |
| 57 | 57 | #define CLK_PLL_SRC 31 | |
| 58 | #define END_PRIMARY_CLK_F7 31 | 58 | #define CLK_DFSDM1 32 |
| 59 | #define CLK_ADFSDM1 33 | ||
| 60 | #define CLK_F769_DSI 34 | ||
| 61 | #define END_PRIMARY_CLK_F7 35 | ||
| 59 | 62 | ||
| 60 | #endif | 63 | #endif |
