[linux-yocto][v6.1/standard/preempt-rt/sdkv6.1/xlnx-soc][PATCH] Revert "drivers: clk: zynqmp: update divider round rate logic"

2024-07-09 Thread quanyang.wang via lists.yoctoproject.org
From: Quanyang Wang 

This patch reverts the commit c249ef9d0978a ("drivers: clk: zynqmp:
update divider round rate logic").

This is because that there has been a similar commit efe0d3640f6ff
("drivers: clk: zynqmp: update divider round rate logic") which is
picked from SDK. This commit introduces some problem and the SDK patch
7e6654b576a00 ("drivers: clk: zynqmp: add hack to use old algorithm
for divider round rate") is to fix it. But when merging, the content of
the commit 7e6654b576a00 is missing. So we need to revert the commit
c249ef9d0978a and bring the content of the commit 7e6654b576a00 back.

Signed-off-by: Quanyang Wang 
---
Hi Bruce,
Would you please help merge this patch to the branches:
v6.1/standard/preempt-rt/sdkv6.1/xlnx-soc
v6.1/standard/sdkv6.1/xlnx-soc
Thanks,
Quanyang
---
 drivers/clk/zynqmp/divider.c | 88 ++--
 1 file changed, 83 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c
index a491f19ef7f8b..0ed124ba0ea6b 100644
--- a/drivers/clk/zynqmp/divider.c
+++ b/drivers/clk/zynqmp/divider.c
@@ -111,6 +111,51 @@ static unsigned long zynqmp_clk_divider_recalc_rate(struct 
clk_hw *hw,
return DIV_ROUND_UP_ULL(parent_rate, value);
 }
 
+static void zynqmp_get_divider2_val(struct clk_hw *hw, unsigned long rate,
+   struct zynqmp_clk_divider *divider,
+   u32 *bestdiv)
+{
+   int div1;
+   int div2;
+   long error = LONG_MAX;
+   unsigned long div1_prate;
+   struct clk_hw *div1_parent_hw;
+   struct zynqmp_clk_divider *pdivider;
+   struct clk_hw *div2_parent_hw = clk_hw_get_parent(hw);
+
+   if (!div2_parent_hw)
+   return;
+
+   pdivider = to_zynqmp_clk_divider(div2_parent_hw);
+   if (!pdivider)
+   return;
+
+   div1_parent_hw = clk_hw_get_parent(div2_parent_hw);
+   if (!div1_parent_hw)
+   return;
+
+   div1_prate = clk_hw_get_rate(div1_parent_hw);
+   *bestdiv = 1;
+   for (div1 = 1; div1 <= pdivider->max_div;) {
+   for (div2 = 1; div2 <= divider->max_div;) {
+   long new_error = ((div1_prate / div1) / div2) - rate;
+
+   if (abs(new_error) < abs(error)) {
+   *bestdiv = div2;
+   error = new_error;
+   }
+   if (divider->flags & CLK_DIVIDER_POWER_OF_TWO)
+   div2 = div2 << 1;
+   else
+   div2++;
+   }
+   if (pdivider->flags & CLK_DIVIDER_POWER_OF_TWO)
+   div1 = div1 << 1;
+   else
+   div1++;
+   }
+}
+
 /**
  * zynqmp_clk_divider_round_rate() - Round rate of divider clock
  * @hw:handle between common and hardware-specific 
interfaces
@@ -129,7 +174,8 @@ static long zynqmp_clk_divider_round_rate(struct clk_hw *hw,
u32 div_type = divider->div_type;
u32 bestdiv;
int ret;
-   u8 width = 0;
+   u8 width;
+   struct device_node *np;
 
/* if read only, just return current value */
if (divider->flags & CLK_DIVIDER_READ_ONLY) {
@@ -149,12 +195,44 @@ static long zynqmp_clk_divider_round_rate(struct clk_hw 
*hw,
return DIV_ROUND_UP_ULL((u64)*prate, bestdiv);
}
 
-   width = fls(divider->max_div);
+   /*
+* Hack to use old algorithm for round rate div clocks. Currently PL
+* rate is getting changed because RPLL_TO_FPD clock is changing RPLL
+* rate for DP audio driver. Using old algorithm RPLL rate change is
+* less and its not affecting PL clocks more so as a temporary solution
+* use old algorithm for Versal and ZynqMP platforms.
+*
+* TBD: Remove this hack and use new algorithm for all platform once PL
+* clock issue is fixed with better way.
+*/
+   np = of_find_compatible_node(NULL, NULL, "xlnx,versal-net");
+   if (np) {
+   width = fls(divider->max_div);
 
-   rate = divider_round_rate(hw, rate, prate, NULL, width, divider->flags);
+   rate = divider_round_rate(hw, rate, prate, NULL, width, 
divider->flags);
 
-   if (divider->is_frac && (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) && 
(rate % *prate))
-   *prate = rate;
+   if (divider->is_frac && (clk_hw_get_flags(hw) & 
CLK_SET_RATE_PARENT) &&
+   (rate % *prate))
+   *prate = rate;
+   } else {
+   bestdiv = zynqmp_divider_get_val(*prate, rate, divider->flags);
+
+   /*
+* In case of two divisors, compute best divider values and 
return
+* divider2 value based on compute value. div1 will  be 
automatically
+* set to 

Re: [linux-yocto] [linux-yocto std&preemp-rt kernel v6.6]: nxp-s32g: pinctrl: s32cc: use devm_kzalloc() to alloc pinctrl_desc struct to avoid random value

2024-07-09 Thread Zhantao Tang via lists.yoctoproject.org

On 2024/7/9 21:11, Bruce Ashfield wrote:

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know 
the content is safe.

In message: Re: [linux-yocto] [linux-yocto std&preemp-rt kernel v6.6]: 
nxp-s32g: pinctrl: s32cc: use devm_kzalloc() to alloc pinctrl_desc struct to avoid 
random value
on 09/07/2024 zhantao.tang wrote:


On 2024/7/9 11:19, Bruce Ashfield wrote:

 CAUTION: This email comes from a non Wind River email account!
 Do not click links or open attachments unless you recognize the sender and 
know the content is safe.

 In message: [linux-yocto] [linux-yocto std&preemp-rt kernel v6.6]: 
nxp-s32g: pinctrl: s32cc: use devm_kzalloc() to alloc pinctrl_desc struct to avoid 
random value
 on 09/07/2024 Zhantao Tang wrote:


 Hi Bruce,

 There is a patch for v6.6 kernel to fix one pinctrl issue.
 Would you please help to merge it to the following branches?
   v6.6/standard/nxp-sdk-6.6/nxp-s32g
   v6.6/standard/preempt-rt/nxp-sdk-6.6/nxp-s32g

 merged.

Hi Bruce,


Thanks for your merging.

I checked the codes, but it seems that you pushed the commit a0089d1f("irq:
imx: irqsteer: Unset data->domain->dev"),
which is for v6.6/standard/preempt-rt/nxp-sdk-6.6/nxp-soc and v6.1/standard/
preempt-rt/nxp-sdk-6.1/nxp-soc branches, to s32g branches.

I think it is because the branch names are so similar for S32G and other NXP
soc branch,

And the patch "pinctrl: s32cc: use devm_kzalloc() to alloc pinctrl_desc struct
to avoid random value" is the right one for S32G branches:
 v6.6/standard/nxp-sdk-6.6/nxp-s32g
 v6.6/standard/preempt-rt/nxp-sdk-6.6/nxp-s32g

So would you please help to correct it?

I've reverted the patch and grabbed yours, everything should be
fixed now.

It wasn't the similarity of the branch names, I don't actually
type the branches in, I have scripts that process the mbox by
extracting the patch and then applying it to the branches .. but
your patch and the incorrectly patch have the same starting prefix
for the patch so my scripts overwrote the correct patch with
the second and applied it!


OK, got it.

Very appreciate for your quick and hard work.


Thanks,

Zhantao


Bruce



Thanks,

Zhantao

 Bruce



 Thanks,
 Zhantao






-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#14132): 
https://lists.yoctoproject.org/g/linux-yocto/message/14132
Mute This Topic: https://lists.yoctoproject.org/mt/107116486/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [linux-yocto] [linux-yocto std&preemp-rt kernel v6.6]: nxp-s32g: pci: dwc: s32cc: use the dedicated msi_irq[0] to fix compile warning

2024-07-09 Thread Bruce Ashfield
In message: [linux-yocto] [linux-yocto std&preemp-rt kernel v6.6]: nxp-s32g: 
pci: dwc: s32cc: use the dedicated msi_irq[0] to fix compile warning
on 09/07/2024 Zhantao Tang wrote:

> Hi Bruce,
> 
> There is a patch for v6.6 kernel to fix pci compile warning.
> Would you please help to merge it to the following branches?
>   v6.6/standard/nxp-sdk-6.6/nxp-s32g
>   v6.6/standard/preempt-rt/nxp-sdk-6.6/nxp-s32g

merged.

Bruce

> 
> 
> Thanks,
> Zhantao
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#14130): 
https://lists.yoctoproject.org/g/linux-yocto/message/14130
Mute This Topic: https://lists.yoctoproject.org/mt/107119572/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [linux-yocto] [yocto-kernel-cache kernel v6.6]: nxp-s32g: add PCA953X support

2024-07-09 Thread Bruce Ashfield
In message: [yocto-kernel-cache kernel v6.6]: nxp-s32g: add PCA953X support
on 09/07/2024 Zhantao Tang wrote:

> Hi Bruce,
> 
> There is a patch to add PCA953X support for v6.6 kernel for nxp-s32g bsp,
> would you please help to merge the following patch into
>   yocto-6.6
> branch?

merged.

Bruce

> 
> Thanks,
> Zhantao
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#14129): 
https://lists.yoctoproject.org/g/linux-yocto/message/14129
Mute This Topic: https://lists.yoctoproject.org/mt/107119566/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [linux-yocto] [linux-yocto std&preemp-rt kernel v6.6]: nxp-s32g: pinctrl: s32cc: use devm_kzalloc() to alloc pinctrl_desc struct to avoid random value

2024-07-09 Thread Bruce Ashfield
In message: Re: [linux-yocto] [linux-yocto std&preemp-rt kernel v6.6]: 
nxp-s32g: pinctrl: s32cc: use devm_kzalloc() to alloc pinctrl_desc struct to 
avoid random value
on 09/07/2024 zhantao.tang wrote:

> On 2024/7/9 11:19, Bruce Ashfield wrote:
> 
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender 
> and know the content is safe.
> 
> In message: [linux-yocto] [linux-yocto std&preemp-rt kernel v6.6]: 
> nxp-s32g: pinctrl: s32cc: use devm_kzalloc() to alloc pinctrl_desc struct to 
> avoid random value
> on 09/07/2024 Zhantao Tang wrote:
> 
> 
> Hi Bruce,
> 
> There is a patch for v6.6 kernel to fix one pinctrl issue.
> Would you please help to merge it to the following branches?
>   v6.6/standard/nxp-sdk-6.6/nxp-s32g
>   v6.6/standard/preempt-rt/nxp-sdk-6.6/nxp-s32g
> 
> merged.
> 
> Hi Bruce,
> 
> 
> Thanks for your merging.
> 
> I checked the codes, but it seems that you pushed the commit a0089d1f("irq:
> imx: irqsteer: Unset data->domain->dev"),
> which is for v6.6/standard/preempt-rt/nxp-sdk-6.6/nxp-soc and v6.1/standard/
> preempt-rt/nxp-sdk-6.1/nxp-soc branches, to s32g branches.
> 
> I think it is because the branch names are so similar for S32G and other NXP
> soc branch,
> 
> And the patch "pinctrl: s32cc: use devm_kzalloc() to alloc pinctrl_desc struct
> to avoid random value" is the right one for S32G branches:
> v6.6/standard/nxp-sdk-6.6/nxp-s32g
> v6.6/standard/preempt-rt/nxp-sdk-6.6/nxp-s32g
> 
> So would you please help to correct it?

I've reverted the patch and grabbed yours, everything should be
fixed now.

It wasn't the similarity of the branch names, I don't actually
type the branches in, I have scripts that process the mbox by
extracting the patch and then applying it to the branches .. but
your patch and the incorrectly patch have the same starting prefix
for the patch so my scripts overwrote the correct patch with
the second and applied it!

Bruce

> 
> 
> Thanks,
> 
> Zhantao
> 
> Bruce
> 
> 
> 
> Thanks,
> Zhantao
> 
> 
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#14128): 
https://lists.yoctoproject.org/g/linux-yocto/message/14128
Mute This Topic: https://lists.yoctoproject.org/mt/107116486/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[linux-yocto] [linux-yocto std&preemp-rt kernel v6.6]: nxp-s32g: pci: dwc: s32cc: use the dedicated msi_irq[0] to fix compile warning

2024-07-09 Thread Zhantao Tang via lists.yoctoproject.org
Hi Bruce,

There is a patch for v6.6 kernel to fix pci compile warning.
Would you please help to merge it to the following branches?
v6.6/standard/nxp-sdk-6.6/nxp-s32g
v6.6/standard/preempt-rt/nxp-sdk-6.6/nxp-s32g


Thanks,
Zhantao


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#14126): 
https://lists.yoctoproject.org/g/linux-yocto/message/14126
Mute This Topic: https://lists.yoctoproject.org/mt/107119572/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[linux-yocto] [PATCH] pci: dwc: s32cc: use the dedicated msi_irq[0] to fix compile warning

2024-07-09 Thread Zhantao Tang via lists.yoctoproject.org
This patch is to fix the following compile warning:
  pci-s32cc-ep.c:504:21: warning: the comparison will always evaluate as 'true' 
for the address of 'msi_irq' will never be NULL [-Waddress]

The reason it that, the variable pp->msi_irq is always true, since it is a
array, so change to use pp->msi_irq[0], which is the real used irq for s32g
pci driver, to fix the above warning.

Signed-off-by: Zhantao Tang 
---
 drivers/pci/controller/dwc/pci-s32cc-ep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pci-s32cc-ep.c 
b/drivers/pci/controller/dwc/pci-s32cc-ep.c
index 37f649ce83e1..7ddf12e64682 100644
--- a/drivers/pci/controller/dwc/pci-s32cc-ep.c
+++ b/drivers/pci/controller/dwc/pci-s32cc-ep.c
@@ -501,7 +501,7 @@ static int s32cc_pcie_config_ep(struct s32cc_pcie *s32cc_pp,
if (ret)
dev_err(dev, "Unable to setup MSI domain for EP\n");
 
-   if (pp->msi_irq)
+   if (pp->msi_irq[0])
irq_set_chained_handler_and_data(pp->msi_irq[0],
 dw_ep_chained_msi_isr,
 pp);
-- 
2.34.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#14127): 
https://lists.yoctoproject.org/g/linux-yocto/message/14127
Mute This Topic: https://lists.yoctoproject.org/mt/107119573/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[linux-yocto] [PATCH] nxp-s32g: add PCA953X support

2024-07-09 Thread Zhantao Tang via lists.yoctoproject.org
The PCA953X is needed by S32G and which is enabled in SDK BSP41 by
default, so enable it to keep align with SDK.

Signed-off-by: Zhantao Tang 
---
 bsp/nxp-s32g/nxp-s32g.cfg | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bsp/nxp-s32g/nxp-s32g.cfg b/bsp/nxp-s32g/nxp-s32g.cfg
index 57ac3a18..27be9899 100644
--- a/bsp/nxp-s32g/nxp-s32g.cfg
+++ b/bsp/nxp-s32g/nxp-s32g.cfg
@@ -77,6 +77,7 @@ CONFIG_GPIO_CDEV=y
 CONFIG_GPIO_S32CC=y
 CONFIG_GPIO_SCMI=y
 CONFIG_SENSORS_INA2XX=y
+CONFIG_GPIO_PCA953X=y
 
 #PCIE
 CONFIG_PCI=y
-- 
2.34.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#14125): 
https://lists.yoctoproject.org/g/linux-yocto/message/14125
Mute This Topic: https://lists.yoctoproject.org/mt/107119567/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[linux-yocto] [yocto-kernel-cache kernel v6.6]: nxp-s32g: add PCA953X support

2024-07-09 Thread Zhantao Tang via lists.yoctoproject.org
Hi Bruce,

There is a patch to add PCA953X support for v6.6 kernel for nxp-s32g bsp,
would you please help to merge the following patch into
yocto-6.6
branch?

Thanks,
Zhantao


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#14124): 
https://lists.yoctoproject.org/g/linux-yocto/message/14124
Mute This Topic: https://lists.yoctoproject.org/mt/107119566/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [linux-yocto] [linux-yocto std&preemp-rt kernel v6.6]: nxp-s32g: pinctrl: s32cc: use devm_kzalloc() to alloc pinctrl_desc struct to avoid random value

2024-07-09 Thread Zhantao Tang via lists.yoctoproject.org

On 2024/7/9 11:19, Bruce Ashfield wrote:

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know 
the content is safe.

In message: [linux-yocto] [linux-yocto std&preemp-rt kernel v6.6]: nxp-s32g: 
pinctrl: s32cc: use devm_kzalloc() to alloc pinctrl_desc struct to avoid random 
value
on 09/07/2024 Zhantao Tang wrote:


Hi Bruce,

There is a patch for v6.6 kernel to fix one pinctrl issue.
Would you please help to merge it to the following branches?
   v6.6/standard/nxp-sdk-6.6/nxp-s32g
   v6.6/standard/preempt-rt/nxp-sdk-6.6/nxp-s32g

merged.


Hi Bruce,


Thanks for your merging.

I checked the codes, but it seems that you pushed the commit 
a0089d1f("irq: imx: irqsteer: Unset data->domain->dev"),
which is for v6.6/standard/preempt-rt/nxp-sdk-6.6/nxp-soc and 
v6.1/standard/preempt-rt/nxp-sdk-6.1/nxp-soc branches, to s32g branches.


I think it is because the branch names are so similar for S32G and other 
NXP soc branch,


And the patch "pinctrl: s32cc: use devm_kzalloc() to alloc pinctrl_desc 
struct to avoid random value" is the right one for S32G branches:

v6.6/standard/nxp-sdk-6.6/nxp-s32g
v6.6/standard/preempt-rt/nxp-sdk-6.6/nxp-s32g

So would you please help to correct it?


Thanks,

Zhantao


Bruce



Thanks,
Zhantao


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#14123): 
https://lists.yoctoproject.org/g/linux-yocto/message/14123
Mute This Topic: https://lists.yoctoproject.org/mt/107116486/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-