diff options
| -rw-r--r-- | drivers/clk/clk-stm32mp1.c | 54 | ||||
| -rw-r--r-- | include/dt-bindings/clock/stm32mp1-clks.h | 4 |
2 files changed, 25 insertions, 33 deletions
diff --git a/drivers/clk/clk-stm32mp1.c b/drivers/clk/clk-stm32mp1.c index f1d5967b4b39..edd3cf451401 100644 --- a/drivers/clk/clk-stm32mp1.c +++ b/drivers/clk/clk-stm32mp1.c | |||
| @@ -216,7 +216,7 @@ static const char * const usart1_src[] = { | |||
| 216 | "pclk5", "pll3_q", "ck_hsi", "ck_csi", "pll4_q", "ck_hse" | 216 | "pclk5", "pll3_q", "ck_hsi", "ck_csi", "pll4_q", "ck_hse" |
| 217 | }; | 217 | }; |
| 218 | 218 | ||
| 219 | const char * const usart234578_src[] = { | 219 | static const char * const usart234578_src[] = { |
| 220 | "pclk1", "pll4_q", "ck_hsi", "ck_csi", "ck_hse" | 220 | "pclk1", "pll4_q", "ck_hsi", "ck_csi", "ck_hse" |
| 221 | }; | 221 | }; |
| 222 | 222 | ||
| @@ -224,10 +224,6 @@ static const char * const usart6_src[] = { | |||
| 224 | "pclk2", "pll4_q", "ck_hsi", "ck_csi", "ck_hse" | 224 | "pclk2", "pll4_q", "ck_hsi", "ck_csi", "ck_hse" |
| 225 | }; | 225 | }; |
| 226 | 226 | ||
| 227 | static const char * const dfsdm_src[] = { | ||
| 228 | "pclk2", "ck_mcu" | ||
| 229 | }; | ||
| 230 | |||
| 231 | static const char * const fdcan_src[] = { | 227 | static const char * const fdcan_src[] = { |
| 232 | "ck_hse", "pll3_q", "pll4_q" | 228 | "ck_hse", "pll3_q", "pll4_q" |
| 233 | }; | 229 | }; |
| @@ -316,10 +312,8 @@ struct stm32_clk_mgate { | |||
| 316 | struct clock_config { | 312 | struct clock_config { |
| 317 | u32 id; | 313 | u32 id; |
| 318 | const char *name; | 314 | const char *name; |
| 319 | union { | 315 | const char *parent_name; |
| 320 | const char *parent_name; | 316 | const char * const *parent_names; |
| 321 | const char * const *parent_names; | ||
| 322 | }; | ||
| 323 | int num_parents; | 317 | int num_parents; |
| 324 | unsigned long flags; | 318 | unsigned long flags; |
| 325 | void *cfg; | 319 | void *cfg; |
| @@ -469,7 +463,7 @@ static void mp1_gate_clk_disable(struct clk_hw *hw) | |||
| 469 | } | 463 | } |
| 470 | } | 464 | } |
| 471 | 465 | ||
| 472 | const struct clk_ops mp1_gate_clk_ops = { | 466 | static const struct clk_ops mp1_gate_clk_ops = { |
| 473 | .enable = mp1_gate_clk_enable, | 467 | .enable = mp1_gate_clk_enable, |
| 474 | .disable = mp1_gate_clk_disable, | 468 | .disable = mp1_gate_clk_disable, |
| 475 | .is_enabled = clk_gate_is_enabled, | 469 | .is_enabled = clk_gate_is_enabled, |
| @@ -698,7 +692,7 @@ static void mp1_mgate_clk_disable(struct clk_hw *hw) | |||
| 698 | mp1_gate_clk_disable(hw); | 692 | mp1_gate_clk_disable(hw); |
| 699 | } | 693 | } |
| 700 | 694 | ||
| 701 | const struct clk_ops mp1_mgate_clk_ops = { | 695 | static const struct clk_ops mp1_mgate_clk_ops = { |
| 702 | .enable = mp1_mgate_clk_enable, | 696 | .enable = mp1_mgate_clk_enable, |
| 703 | .disable = mp1_mgate_clk_disable, | 697 | .disable = mp1_mgate_clk_disable, |
| 704 | .is_enabled = clk_gate_is_enabled, | 698 | .is_enabled = clk_gate_is_enabled, |
| @@ -732,7 +726,7 @@ static int clk_mmux_set_parent(struct clk_hw *hw, u8 index) | |||
| 732 | return 0; | 726 | return 0; |
| 733 | } | 727 | } |
| 734 | 728 | ||
| 735 | const struct clk_ops clk_mmux_ops = { | 729 | static const struct clk_ops clk_mmux_ops = { |
| 736 | .get_parent = clk_mmux_get_parent, | 730 | .get_parent = clk_mmux_get_parent, |
| 737 | .set_parent = clk_mmux_set_parent, | 731 | .set_parent = clk_mmux_set_parent, |
| 738 | .determine_rate = __clk_mux_determine_rate, | 732 | .determine_rate = __clk_mux_determine_rate, |
| @@ -1048,10 +1042,10 @@ struct stm32_pll_cfg { | |||
| 1048 | u32 offset; | 1042 | u32 offset; |
| 1049 | }; | 1043 | }; |
| 1050 | 1044 | ||
| 1051 | struct clk_hw *_clk_register_pll(struct device *dev, | 1045 | static struct clk_hw *_clk_register_pll(struct device *dev, |
| 1052 | struct clk_hw_onecell_data *clk_data, | 1046 | struct clk_hw_onecell_data *clk_data, |
| 1053 | void __iomem *base, spinlock_t *lock, | 1047 | void __iomem *base, spinlock_t *lock, |
| 1054 | const struct clock_config *cfg) | 1048 | const struct clock_config *cfg) |
| 1055 | { | 1049 | { |
| 1056 | struct stm32_pll_cfg *stm_pll_cfg = cfg->cfg; | 1050 | struct stm32_pll_cfg *stm_pll_cfg = cfg->cfg; |
| 1057 | 1051 | ||
| @@ -1405,7 +1399,8 @@ enum { | |||
| 1405 | G_USBH, | 1399 | G_USBH, |
| 1406 | G_ETHSTP, | 1400 | G_ETHSTP, |
| 1407 | G_RTCAPB, | 1401 | G_RTCAPB, |
| 1408 | G_TZC, | 1402 | G_TZC1, |
| 1403 | G_TZC2, | ||
| 1409 | G_TZPC, | 1404 | G_TZPC, |
| 1410 | G_IWDG1, | 1405 | G_IWDG1, |
| 1411 | G_BSEC, | 1406 | G_BSEC, |
| @@ -1417,7 +1412,7 @@ enum { | |||
| 1417 | G_LAST | 1412 | G_LAST |
| 1418 | }; | 1413 | }; |
| 1419 | 1414 | ||
| 1420 | struct stm32_mgate mp1_mgate[G_LAST]; | 1415 | static struct stm32_mgate mp1_mgate[G_LAST]; |
| 1421 | 1416 | ||
| 1422 | #define _K_GATE(_id, _gate_offset, _gate_bit_idx, _gate_flags,\ | 1417 | #define _K_GATE(_id, _gate_offset, _gate_bit_idx, _gate_flags,\ |
| 1423 | _mgate, _ops)\ | 1418 | _mgate, _ops)\ |
| @@ -1440,7 +1435,7 @@ struct stm32_mgate mp1_mgate[G_LAST]; | |||
| 1440 | &mp1_mgate[_id], &mp1_mgate_clk_ops) | 1435 | &mp1_mgate[_id], &mp1_mgate_clk_ops) |
| 1441 | 1436 | ||
| 1442 | /* Peripheral gates */ | 1437 | /* Peripheral gates */ |
| 1443 | struct stm32_gate_cfg per_gate_cfg[G_LAST] = { | 1438 | static struct stm32_gate_cfg per_gate_cfg[G_LAST] = { |
| 1444 | /* Multi gates */ | 1439 | /* Multi gates */ |
| 1445 | K_GATE(G_MDIO, RCC_APB1ENSETR, 31, 0), | 1440 | K_GATE(G_MDIO, RCC_APB1ENSETR, 31, 0), |
| 1446 | K_MGATE(G_DAC12, RCC_APB1ENSETR, 29, 0), | 1441 | K_MGATE(G_DAC12, RCC_APB1ENSETR, 29, 0), |
| @@ -1506,7 +1501,8 @@ struct stm32_gate_cfg per_gate_cfg[G_LAST] = { | |||
| 1506 | K_GATE(G_BSEC, RCC_APB5ENSETR, 16, 0), | 1501 | K_GATE(G_BSEC, RCC_APB5ENSETR, 16, 0), |
| 1507 | K_GATE(G_IWDG1, RCC_APB5ENSETR, 15, 0), | 1502 | K_GATE(G_IWDG1, RCC_APB5ENSETR, 15, 0), |
| 1508 | K_GATE(G_TZPC, RCC_APB5ENSETR, 13, 0), | 1503 | K_GATE(G_TZPC, RCC_APB5ENSETR, 13, 0), |
| 1509 | K_GATE(G_TZC, RCC_APB5ENSETR, 12, 0), | 1504 | K_GATE(G_TZC2, RCC_APB5ENSETR, 12, 0), |
| 1505 | K_GATE(G_TZC1, RCC_APB5ENSETR, 11, 0), | ||
| 1510 | K_GATE(G_RTCAPB, RCC_APB5ENSETR, 8, 0), | 1506 | K_GATE(G_RTCAPB, RCC_APB5ENSETR, 8, 0), |
| 1511 | K_MGATE(G_USART1, RCC_APB5ENSETR, 4, 0), | 1507 | K_MGATE(G_USART1, RCC_APB5ENSETR, 4, 0), |
| 1512 | K_MGATE(G_I2C6, RCC_APB5ENSETR, 3, 0), | 1508 | K_MGATE(G_I2C6, RCC_APB5ENSETR, 3, 0), |
| @@ -1600,7 +1596,7 @@ enum { | |||
| 1600 | M_LAST | 1596 | M_LAST |
| 1601 | }; | 1597 | }; |
| 1602 | 1598 | ||
| 1603 | struct stm32_mmux ker_mux[M_LAST]; | 1599 | static struct stm32_mmux ker_mux[M_LAST]; |
| 1604 | 1600 | ||
| 1605 | #define _K_MUX(_id, _offset, _shift, _width, _mux_flags, _mmux, _ops)\ | 1601 | #define _K_MUX(_id, _offset, _shift, _width, _mux_flags, _mmux, _ops)\ |
| 1606 | [_id] = {\ | 1602 | [_id] = {\ |
| @@ -1623,7 +1619,7 @@ struct stm32_mmux ker_mux[M_LAST]; | |||
| 1623 | _K_MUX(_id, _offset, _shift, _width, _mux_flags,\ | 1619 | _K_MUX(_id, _offset, _shift, _width, _mux_flags,\ |
| 1624 | &ker_mux[_id], &clk_mmux_ops) | 1620 | &ker_mux[_id], &clk_mmux_ops) |
| 1625 | 1621 | ||
| 1626 | const struct stm32_mux_cfg ker_mux_cfg[M_LAST] = { | 1622 | static const struct stm32_mux_cfg ker_mux_cfg[M_LAST] = { |
| 1627 | /* Kernel multi mux */ | 1623 | /* Kernel multi mux */ |
| 1628 | K_MMUX(M_SDMMC12, RCC_SDMMC12CKSELR, 0, 3, 0), | 1624 | K_MMUX(M_SDMMC12, RCC_SDMMC12CKSELR, 0, 3, 0), |
| 1629 | K_MMUX(M_SPI23, RCC_SPI2S23CKSELR, 0, 3, 0), | 1625 | K_MMUX(M_SPI23, RCC_SPI2S23CKSELR, 0, 3, 0), |
| @@ -1860,7 +1856,8 @@ static const struct clock_config stm32mp1_clock_cfg[] = { | |||
| 1860 | PCLK(USART1, "usart1", "pclk5", 0, G_USART1), | 1856 | PCLK(USART1, "usart1", "pclk5", 0, G_USART1), |
| 1861 | PCLK(RTCAPB, "rtcapb", "pclk5", CLK_IGNORE_UNUSED | | 1857 | PCLK(RTCAPB, "rtcapb", "pclk5", CLK_IGNORE_UNUSED | |
| 1862 | CLK_IS_CRITICAL, G_RTCAPB), | 1858 | CLK_IS_CRITICAL, G_RTCAPB), |
| 1863 | PCLK(TZC, "tzc", "pclk5", CLK_IGNORE_UNUSED, G_TZC), | 1859 | PCLK(TZC1, "tzc1", "ck_axi", CLK_IGNORE_UNUSED, G_TZC1), |
| 1860 | PCLK(TZC2, "tzc2", "ck_axi", CLK_IGNORE_UNUSED, G_TZC2), | ||
| 1864 | PCLK(TZPC, "tzpc", "pclk5", CLK_IGNORE_UNUSED, G_TZPC), | 1861 | PCLK(TZPC, "tzpc", "pclk5", CLK_IGNORE_UNUSED, G_TZPC), |
| 1865 | PCLK(IWDG1, "iwdg1", "pclk5", 0, G_IWDG1), | 1862 | PCLK(IWDG1, "iwdg1", "pclk5", 0, G_IWDG1), |
| 1866 | PCLK(BSEC, "bsec", "pclk5", CLK_IGNORE_UNUSED, G_BSEC), | 1863 | PCLK(BSEC, "bsec", "pclk5", CLK_IGNORE_UNUSED, G_BSEC), |
| @@ -1916,8 +1913,7 @@ static const struct clock_config stm32mp1_clock_cfg[] = { | |||
| 1916 | KCLK(RNG1_K, "rng1_k", rng_src, 0, G_RNG1, M_RNG1), | 1913 | KCLK(RNG1_K, "rng1_k", rng_src, 0, G_RNG1, M_RNG1), |
| 1917 | KCLK(RNG2_K, "rng2_k", rng_src, 0, G_RNG2, M_RNG2), | 1914 | KCLK(RNG2_K, "rng2_k", rng_src, 0, G_RNG2, M_RNG2), |
| 1918 | KCLK(USBPHY_K, "usbphy_k", usbphy_src, 0, G_USBPHY, M_USBPHY), | 1915 | KCLK(USBPHY_K, "usbphy_k", usbphy_src, 0, G_USBPHY, M_USBPHY), |
| 1919 | KCLK(STGEN_K, "stgen_k", stgen_src, CLK_IGNORE_UNUSED, | 1916 | KCLK(STGEN_K, "stgen_k", stgen_src, CLK_IS_CRITICAL, G_STGEN, M_STGEN), |
| 1920 | G_STGEN, M_STGEN), | ||
| 1921 | KCLK(SPDIF_K, "spdif_k", spdif_src, 0, G_SPDIF, M_SPDIF), | 1917 | KCLK(SPDIF_K, "spdif_k", spdif_src, 0, G_SPDIF, M_SPDIF), |
| 1922 | KCLK(SPI1_K, "spi1_k", spi123_src, 0, G_SPI1, M_SPI1), | 1918 | KCLK(SPI1_K, "spi1_k", spi123_src, 0, G_SPI1, M_SPI1), |
| 1923 | KCLK(SPI2_K, "spi2_k", spi123_src, 0, G_SPI2, M_SPI23), | 1919 | KCLK(SPI2_K, "spi2_k", spi123_src, 0, G_SPI2, M_SPI23), |
| @@ -1948,8 +1944,8 @@ static const struct clock_config stm32mp1_clock_cfg[] = { | |||
| 1948 | KCLK(FDCAN_K, "fdcan_k", fdcan_src, 0, G_FDCAN, M_FDCAN), | 1944 | KCLK(FDCAN_K, "fdcan_k", fdcan_src, 0, G_FDCAN, M_FDCAN), |
| 1949 | KCLK(SAI1_K, "sai1_k", sai_src, 0, G_SAI1, M_SAI1), | 1945 | KCLK(SAI1_K, "sai1_k", sai_src, 0, G_SAI1, M_SAI1), |
| 1950 | KCLK(SAI2_K, "sai2_k", sai2_src, 0, G_SAI2, M_SAI2), | 1946 | KCLK(SAI2_K, "sai2_k", sai2_src, 0, G_SAI2, M_SAI2), |
| 1951 | KCLK(SAI3_K, "sai3_k", sai_src, 0, G_SAI2, M_SAI3), | 1947 | KCLK(SAI3_K, "sai3_k", sai_src, 0, G_SAI3, M_SAI3), |
| 1952 | KCLK(SAI4_K, "sai4_k", sai_src, 0, G_SAI2, M_SAI4), | 1948 | KCLK(SAI4_K, "sai4_k", sai_src, 0, G_SAI4, M_SAI4), |
| 1953 | KCLK(ADC12_K, "adc12_k", adc12_src, 0, G_ADC12, M_ADC12), | 1949 | KCLK(ADC12_K, "adc12_k", adc12_src, 0, G_ADC12, M_ADC12), |
| 1954 | KCLK(DSI_K, "dsi_k", dsi_src, 0, G_DSI, M_DSI), | 1950 | KCLK(DSI_K, "dsi_k", dsi_src, 0, G_DSI, M_DSI), |
| 1955 | KCLK(ADFSDM_K, "adfsdm_k", sai_src, 0, G_ADFSDM, M_SAI1), | 1951 | KCLK(ADFSDM_K, "adfsdm_k", sai_src, 0, G_ADFSDM, M_SAI1), |
| @@ -1992,10 +1988,6 @@ static const struct clock_config stm32mp1_clock_cfg[] = { | |||
| 1992 | _DIV(RCC_MCO2CFGR, 4, 4, 0, NULL)), | 1988 | _DIV(RCC_MCO2CFGR, 4, 4, 0, NULL)), |
| 1993 | 1989 | ||
| 1994 | /* Debug clocks */ | 1990 | /* Debug clocks */ |
| 1995 | FIXED_FACTOR(NO_ID, "ck_axi_div2", "ck_axi", 0, 1, 2), | ||
| 1996 | |||
| 1997 | GATE(DBG, "ck_apb_dbg", "ck_axi_div2", 0, RCC_DBGCFGR, 8, 0), | ||
| 1998 | |||
| 1999 | GATE(CK_DBG, "ck_sys_dbg", "ck_axi", 0, RCC_DBGCFGR, 8, 0), | 1991 | GATE(CK_DBG, "ck_sys_dbg", "ck_axi", 0, RCC_DBGCFGR, 8, 0), |
| 2000 | 1992 | ||
| 2001 | COMPOSITE(CK_TRACE, "ck_trace", ck_trace_src, CLK_OPS_PARENT_ENABLE, | 1993 | COMPOSITE(CK_TRACE, "ck_trace", ck_trace_src, CLK_OPS_PARENT_ENABLE, |
diff --git a/include/dt-bindings/clock/stm32mp1-clks.h b/include/dt-bindings/clock/stm32mp1-clks.h index 86e3ec662ef4..90ec780bfc68 100644 --- a/include/dt-bindings/clock/stm32mp1-clks.h +++ b/include/dt-bindings/clock/stm32mp1-clks.h | |||
| @@ -76,7 +76,7 @@ | |||
| 76 | #define I2C6 63 | 76 | #define I2C6 63 |
| 77 | #define USART1 64 | 77 | #define USART1 64 |
| 78 | #define RTCAPB 65 | 78 | #define RTCAPB 65 |
| 79 | #define TZC 66 | 79 | #define TZC1 66 |
| 80 | #define TZPC 67 | 80 | #define TZPC 67 |
| 81 | #define IWDG1 68 | 81 | #define IWDG1 68 |
| 82 | #define BSEC 69 | 82 | #define BSEC 69 |
| @@ -123,6 +123,7 @@ | |||
| 123 | #define CRC1 110 | 123 | #define CRC1 110 |
| 124 | #define USBH 111 | 124 | #define USBH 111 |
| 125 | #define ETHSTP 112 | 125 | #define ETHSTP 112 |
| 126 | #define TZC2 113 | ||
| 126 | 127 | ||
| 127 | /* Kernel clocks */ | 128 | /* Kernel clocks */ |
| 128 | #define SDMMC1_K 118 | 129 | #define SDMMC1_K 118 |
| @@ -228,7 +229,6 @@ | |||
| 228 | #define CK_MCO2 212 | 229 | #define CK_MCO2 212 |
| 229 | 230 | ||
| 230 | /* TRACE & DEBUG clocks */ | 231 | /* TRACE & DEBUG clocks */ |
| 231 | #define DBG 213 | ||
| 232 | #define CK_DBG 214 | 232 | #define CK_DBG 214 |
| 233 | #define CK_TRACE 215 | 233 | #define CK_TRACE 215 |
| 234 | 234 | ||
