* [PATCH] clk: qcom: gcc-ipq6018: rework nss_port5 clock to multiple conf
@ 2025-08-02 9:55 Marko Mäkelä
2025-08-02 11:51 ` Konrad Dybcio
2025-08-11 18:41 ` Bjorn Andersson
0 siblings, 2 replies; 4+ messages in thread
From: Marko Mäkelä @ 2025-08-02 9:55 UTC (permalink / raw)
To: Bjorn Andersson, linux-arm-msm
Cc: Christian Marangi, Robert Marko, Marko Mäkelä
Rework nss_port5 to use the new multiple configuration implementation
and correctly fix the clocks for this port under some corner case.
In OpenWrt, this patch avoids intermittent dmesg errors of the form
nss_port5_rx_clk_src: rcg didn't update its configuration.
This is a mechanical, straightforward port of
commit e88f03230dc07aa3293b6aeb078bd27370bb2594
("clk: qcom: gcc-ipq8074: rework nss_port5/6 clock to multiple conf")
to gcc-ipq6018, with two conflicts resolved: different frequency of the
P_XO clock source, and only 5 Ethernet ports.
This was originally developed by JiaY-shi <shi05275@163.com>.
Link: https://lore.kernel.org/all/20231220221724.3822-4-ansuelsmth@gmail.com/
Signed-off-by: Marko Mäkelä <marko.makela@iki.fi>
Tested-by: Marko Mäkelä <marko.makela@iki.fi>
---
drivers/clk/qcom/gcc-ipq6018.c | 60 +++++++++++++++++++++-------------
1 file changed, 38 insertions(+), 22 deletions(-)
diff --git a/drivers/clk/qcom/gcc-ipq6018.c b/drivers/clk/qcom/gcc-ipq6018.c
index d861191b0c85c..d4fc491a18b22 100644
--- a/drivers/clk/qcom/gcc-ipq6018.c
+++ b/drivers/clk/qcom/gcc-ipq6018.c
@@ -511,15 +511,23 @@ static struct clk_rcg2 apss_ahb_clk_src = {
},
};
-static const struct freq_tbl ftbl_nss_port5_rx_clk_src[] = {
- F(24000000, P_XO, 1, 0, 0),
- F(25000000, P_UNIPHY1_RX, 12.5, 0, 0),
- F(25000000, P_UNIPHY0_RX, 5, 0, 0),
- F(78125000, P_UNIPHY1_RX, 4, 0, 0),
- F(125000000, P_UNIPHY1_RX, 2.5, 0, 0),
- F(125000000, P_UNIPHY0_RX, 1, 0, 0),
- F(156250000, P_UNIPHY1_RX, 2, 0, 0),
- F(312500000, P_UNIPHY1_RX, 1, 0, 0),
+static const struct freq_conf ftbl_nss_port5_rx_clk_src_25[] = {
+ C(P_UNIPHY1_RX, 12.5, 0, 0),
+ C(P_UNIPHY0_RX, 5, 0, 0),
+};
+
+static const struct freq_conf ftbl_nss_port5_rx_clk_src_125[] = {
+ C(P_UNIPHY1_RX, 2.5, 0, 0),
+ C(P_UNIPHY0_RX, 1, 0, 0),
+};
+
+static const struct freq_multi_tbl ftbl_nss_port5_rx_clk_src[] = {
+ FMS(24000000, P_XO, 1, 0, 0),
+ FM(25000000, ftbl_nss_port5_rx_clk_src_25),
+ FMS(78125000, P_UNIPHY1_RX, 4, 0, 0),
+ FM(125000000, ftbl_nss_port5_rx_clk_src_125),
+ FMS(156250000, P_UNIPHY1_RX, 2, 0, 0),
+ FMS(312500000, P_UNIPHY1_RX, 1, 0, 0),
{ }
};
@@ -547,26 +555,34 @@ gcc_xo_uniphy0_rx_tx_uniphy1_rx_tx_ubi32_bias_map[] = {
static struct clk_rcg2 nss_port5_rx_clk_src = {
.cmd_rcgr = 0x68060,
- .freq_tbl = ftbl_nss_port5_rx_clk_src,
+ .freq_multi_tbl = ftbl_nss_port5_rx_clk_src,
.hid_width = 5,
.parent_map = gcc_xo_uniphy0_rx_tx_uniphy1_rx_tx_ubi32_bias_map,
.clkr.hw.init = &(struct clk_init_data){
.name = "nss_port5_rx_clk_src",
.parent_data = gcc_xo_uniphy0_rx_tx_uniphy1_rx_tx_ubi32_bias,
.num_parents = 7,
- .ops = &clk_rcg2_ops,
+ .ops = &clk_rcg2_fm_ops,
},
};
-static const struct freq_tbl ftbl_nss_port5_tx_clk_src[] = {
- F(24000000, P_XO, 1, 0, 0),
- F(25000000, P_UNIPHY1_TX, 12.5, 0, 0),
- F(25000000, P_UNIPHY0_TX, 5, 0, 0),
- F(78125000, P_UNIPHY1_TX, 4, 0, 0),
- F(125000000, P_UNIPHY1_TX, 2.5, 0, 0),
- F(125000000, P_UNIPHY0_TX, 1, 0, 0),
- F(156250000, P_UNIPHY1_TX, 2, 0, 0),
- F(312500000, P_UNIPHY1_TX, 1, 0, 0),
+static const struct freq_conf ftbl_nss_port5_tx_clk_src_25[] = {
+ C(P_UNIPHY1_TX, 12.5, 0, 0),
+ C(P_UNIPHY0_TX, 5, 0, 0),
+};
+
+static const struct freq_conf ftbl_nss_port5_tx_clk_src_125[] = {
+ C(P_UNIPHY1_TX, 2.5, 0, 0),
+ C(P_UNIPHY0_TX, 1, 0, 0),
+};
+
+static const struct freq_multi_tbl ftbl_nss_port5_tx_clk_src[] = {
+ FMS(24000000, P_XO, 1, 0, 0),
+ FM(25000000, ftbl_nss_port5_tx_clk_src_25),
+ FMS(78125000, P_UNIPHY1_TX, 4, 0, 0),
+ FM(125000000, ftbl_nss_port5_tx_clk_src_125),
+ FMS(156250000, P_UNIPHY1_TX, 2, 0, 0),
+ FMS(312500000, P_UNIPHY1_TX, 1, 0, 0),
{ }
};
@@ -594,14 +610,14 @@ gcc_xo_uniphy0_tx_rx_uniphy1_tx_rx_ubi32_bias_map[] = {
static struct clk_rcg2 nss_port5_tx_clk_src = {
.cmd_rcgr = 0x68068,
- .freq_tbl = ftbl_nss_port5_tx_clk_src,
+ .freq_multi_tbl = ftbl_nss_port5_tx_clk_src,
.hid_width = 5,
.parent_map = gcc_xo_uniphy0_tx_rx_uniphy1_tx_rx_ubi32_bias_map,
.clkr.hw.init = &(struct clk_init_data){
.name = "nss_port5_tx_clk_src",
.parent_data = gcc_xo_uniphy0_tx_rx_uniphy1_tx_rx_ubi32_bias,
.num_parents = 7,
- .ops = &clk_rcg2_ops,
+ .ops = &clk_rcg2_fm_ops,
},
};
--
2.50.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] clk: qcom: gcc-ipq6018: rework nss_port5 clock to multiple conf
2025-08-02 9:55 [PATCH] clk: qcom: gcc-ipq6018: rework nss_port5 clock to multiple conf Marko Mäkelä
@ 2025-08-02 11:51 ` Konrad Dybcio
2025-08-04 14:09 ` Marko Mäkelä
2025-08-11 18:41 ` Bjorn Andersson
1 sibling, 1 reply; 4+ messages in thread
From: Konrad Dybcio @ 2025-08-02 11:51 UTC (permalink / raw)
To: Marko Mäkelä, Bjorn Andersson, linux-arm-msm
Cc: Christian Marangi, Robert Marko
On 8/2/25 11:55 AM, Marko Mäkelä wrote:
> Rework nss_port5 to use the new multiple configuration implementation
> and correctly fix the clocks for this port under some corner case.
>
> In OpenWrt, this patch avoids intermittent dmesg errors of the form
> nss_port5_rx_clk_src: rcg didn't update its configuration.
>
> This is a mechanical, straightforward port of
> commit e88f03230dc07aa3293b6aeb078bd27370bb2594
> ("clk: qcom: gcc-ipq8074: rework nss_port5/6 clock to multiple conf")
> to gcc-ipq6018, with two conflicts resolved: different frequency of the
> P_XO clock source, and only 5 Ethernet ports.
>
> This was originally developed by JiaY-shi <shi05275@163.com>.
Hmm.. I'm not sure what to think about this, given that person seems
not to be using their full name (or maybe it is the full name, I don't
know) and hasn't provided a sign-off, but on the other hand this isn't
a very inventive change, so I don't *really* mind - up to you, Bjorn
FWIW for the patch contents:
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> Link: https://lore.kernel.org/all/20231220221724.3822-4-ansuelsmth@gmail.com/
> Signed-off-by: Marko Mäkelä <marko.makela@iki.fi>
> Tested-by: Marko Mäkelä <marko.makela@iki.fi>
We generally assume you test your patches before sending ;)
Konrad
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] clk: qcom: gcc-ipq6018: rework nss_port5 clock to multiple conf
2025-08-02 11:51 ` Konrad Dybcio
@ 2025-08-04 14:09 ` Marko Mäkelä
0 siblings, 0 replies; 4+ messages in thread
From: Marko Mäkelä @ 2025-08-04 14:09 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, linux-arm-msm, Christian Marangi, Robert Marko
Sat, Aug 02, 2025 at 01:51:31PM +0200, Konrad Dybcio wrote:
>On 8/2/25 11:55 AM, Marko Mäkelä wrote:
>> Rework nss_port5 to use the new multiple configuration implementation
>> and correctly fix the clocks for this port under some corner case.
>>
>> In OpenWrt, this patch avoids intermittent dmesg errors of the form
>> nss_port5_rx_clk_src: rcg didn't update its configuration.
>>
>> This is a mechanical, straightforward port of
>> commit e88f03230dc07aa3293b6aeb078bd27370bb2594
>> ("clk: qcom: gcc-ipq8074: rework nss_port5/6 clock to multiple conf")
>> to gcc-ipq6018, with two conflicts resolved: different frequency of the
>> P_XO clock source, and only 5 Ethernet ports.
>>
>> This was originally developed by JiaY-shi <shi05275@163.com>.
>
>Hmm.. I'm not sure what to think about this, given that person seems
>not to be using their full name (or maybe it is the full name, I don't
>know) and hasn't provided a sign-off, but on the other hand this isn't
>a very inventive change, so I don't *really* mind - up to you, Bjorn
This basically is the result of executing the following and resolving
the rather trivial conflicts:
git show e88f03230dc07aa3293b6aeb078bd27370bb2594|
patch drivers/clk/qcom/gcc-ipq6018.c
I actually did that and compared the result to the original patch.
I believe that my Signed-off-by is valid and sufficient due to
Developer's Certificate of Origin 1.1 (b), "The contribution is based
upon previous work." That "previous work" would be the gcc-ipq8074 fix
that this is a subset of. This is what I tried to convey in my commit
message. In the name of openness, I wanted to credit the person who
provided the patch to the OpenWrt community; see
<https://github.com/openwrt/openwrt/pull/14950> and
<https://forum.openwrt.org/t//232618/4>.
I did play with the thought of modifying the patch a little so that I
could without hesitation submit it as my own work. Namely, I could have
replaced two ".num_parents = 7" with equivalent ARRAY_SIZE expressions,
similar to gcc-ipq8074.c. However, that would have violated the
"Separate your changes" guideline.
>FWIW for the patch contents:
>
>Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Thank you!
Marko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] clk: qcom: gcc-ipq6018: rework nss_port5 clock to multiple conf
2025-08-02 9:55 [PATCH] clk: qcom: gcc-ipq6018: rework nss_port5 clock to multiple conf Marko Mäkelä
2025-08-02 11:51 ` Konrad Dybcio
@ 2025-08-11 18:41 ` Bjorn Andersson
1 sibling, 0 replies; 4+ messages in thread
From: Bjorn Andersson @ 2025-08-11 18:41 UTC (permalink / raw)
To: linux-arm-msm, Marko Mäkelä; +Cc: Christian Marangi, Robert Marko
On Sat, 02 Aug 2025 12:55:46 +0300, Marko Mäkelä wrote:
> Rework nss_port5 to use the new multiple configuration implementation
> and correctly fix the clocks for this port under some corner case.
>
> In OpenWrt, this patch avoids intermittent dmesg errors of the form
> nss_port5_rx_clk_src: rcg didn't update its configuration.
>
> This is a mechanical, straightforward port of
> commit e88f03230dc07aa3293b6aeb078bd27370bb2594
> ("clk: qcom: gcc-ipq8074: rework nss_port5/6 clock to multiple conf")
> to gcc-ipq6018, with two conflicts resolved: different frequency of the
> P_XO clock source, and only 5 Ethernet ports.
>
> [...]
Applied, thanks!
[1/1] clk: qcom: gcc-ipq6018: rework nss_port5 clock to multiple conf
commit: 2f7b168323c22faafb1fbf94ef93b7ce5efc15c6
Best regards,
--
Bjorn Andersson <andersson@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-08-11 18:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-02 9:55 [PATCH] clk: qcom: gcc-ipq6018: rework nss_port5 clock to multiple conf Marko Mäkelä
2025-08-02 11:51 ` Konrad Dybcio
2025-08-04 14:09 ` Marko Mäkelä
2025-08-11 18:41 ` Bjorn Andersson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).