Skip to content

Commit e2eef31

Browse files
fancerbebarino
authored andcommitted
clk: baikal-t1: Add shared xGMAC ref/ptp clocks internal parent
Baikal-T1 CCU reference manual says that both xGMAC reference and xGMAC PTP clocks are generated by two different wrappers with the same constant divider thus each producing a 156.25 MHz signal. But for some reason both of these clock sources are gated by a single switch-flag in the CCU registers space - CCU_SYS_XGMAC_BASE.BIT(0). In order to make the clocks handled independently we need to define a shared parental gate so the base clock signal would be switched off only if both of the child-clocks are disabled. Note the ID is intentionally set to -2 since we are going to add a one more internal clock identifier in the next commit. Fixes: 353afa3 ("clk: Add Baikal-T1 CCU Dividers driver") Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru> Link: https://lore.kernel.org/r/20220929225402.9696-4-Sergey.Semin@baikalelectronics.ru Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 3c74208 commit e2eef31

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

drivers/clk/baikal-t1/ccu-div.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ struct ccu_div *ccu_div_hw_register(const struct ccu_div_init_data *div_init)
579579
goto err_free_div;
580580
}
581581
parent_data.fw_name = div_init->parent_name;
582+
parent_data.name = div_init->parent_name;
582583
hw_init.parent_data = &parent_data;
583584
hw_init.num_parents = 1;
584585

drivers/clk/baikal-t1/ccu-div.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
#include <linux/bits.h>
1414
#include <linux/of.h>
1515

16+
/*
17+
* CCU Divider private clock IDs
18+
* @CCU_SYS_XGMAC_CLK: CCU XGMAC internal clock
19+
*/
20+
#define CCU_SYS_XGMAC_CLK -2
21+
1622
/*
1723
* CCU Divider private flags
1824
* @CCU_DIV_SKIP_ONE: Due to some reason divider can't be set to 1.

drivers/clk/baikal-t1/clk-ccu-div.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,12 @@ static const struct ccu_div_info sys_info[] = {
204204
"eth_clk", CCU_SYS_GMAC1_BASE, 5),
205205
CCU_DIV_FIXED_INFO(CCU_SYS_GMAC1_PTP_CLK, "sys_gmac1_ptp_clk",
206206
"eth_clk", 10),
207-
CCU_DIV_GATE_INFO(CCU_SYS_XGMAC_REF_CLK, "sys_xgmac_ref_clk",
208-
"eth_clk", CCU_SYS_XGMAC_BASE, 8),
207+
CCU_DIV_GATE_INFO(CCU_SYS_XGMAC_CLK, "sys_xgmac_clk",
208+
"eth_clk", CCU_SYS_XGMAC_BASE, 1),
209+
CCU_DIV_FIXED_INFO(CCU_SYS_XGMAC_REF_CLK, "sys_xgmac_ref_clk",
210+
"sys_xgmac_clk", 8),
209211
CCU_DIV_FIXED_INFO(CCU_SYS_XGMAC_PTP_CLK, "sys_xgmac_ptp_clk",
210-
"eth_clk", 8),
212+
"sys_xgmac_clk", 8),
211213
CCU_DIV_GATE_INFO(CCU_SYS_USB_CLK, "sys_usb_clk",
212214
"eth_clk", CCU_SYS_USB_BASE, 10),
213215
CCU_DIV_VAR_INFO(CCU_SYS_PVT_CLK, "sys_pvt_clk",

0 commit comments

Comments
 (0)