diff mbox series

[1/2] clk: imx8qxp: extend to support getting I2C IPG clock

Message ID 20200107130304.24028-1-agust@denx.de
State Accepted
Commit f35237e1e4a3ab6049555c8082727e30ce6e733c
Headers show
Series [1/2] clk: imx8qxp: extend to support getting I2C IPG clock | expand

Commit Message

Anatolij Gustschin Jan. 7, 2020, 1:03 p.m. UTC
Since commit d02be21d3004 ("i2c: imx_lpi2c: add ipg clk") getting
I2C clocks doesn't work. Add I2C IPG clock IDs to related switch
statements to fix it.

Signed-off-by: Anatolij Gustschin <agust at denx.de>
Cc: Lukasz Majewski <lukma at denx.de>
---
 drivers/clk/imx/clk-imx8qxp.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Fabio Estevam Jan. 9, 2020, 1:58 p.m. UTC | #1
Hi Anatolij,

On Tue, Jan 7, 2020 at 10:03 AM Anatolij Gustschin <agust at denx.de> wrote:
>
> Since commit d02be21d3004 ("i2c: imx_lpi2c: add ipg clk") getting
> I2C clocks doesn't work. Add I2C IPG clock IDs to related switch
> statements to fix it.

I am wondering if we should just revert this commit instead?
Anatolij Gustschin Jan. 9, 2020, 2:33 p.m. UTC | #2
Hi Fabio,

On Thu, 9 Jan 2020 10:58:30 -0300
Fabio Estevam festevam at gmail.com wrote:

> Hi Anatolij,
> 
> On Tue, Jan 7, 2020 at 10:03 AM Anatolij Gustschin <agust at denx.de> wrote:
> >
> > Since commit d02be21d3004 ("i2c: imx_lpi2c: add ipg clk") getting
> > I2C clocks doesn't work. Add I2C IPG clock IDs to related switch
> > statements to fix it.  
> 
> I am wondering if we should just revert this commit instead?

I'm not sure, this might be required for other i.MX8 SoCs.
Peng, what do you think?

--
Anatolij
Peng Fan Jan. 10, 2020, 1:13 a.m. UTC | #3
> Subject: [PATCH 1/2] clk: imx8qxp: extend to support getting I2C IPG clock
> 
> Since commit d02be21d3004 ("i2c: imx_lpi2c: add ipg clk") getting I2C clocks
> doesn't work. Add I2C IPG clock IDs to related switch statements to fix it.
> 
> Signed-off-by: Anatolij Gustschin <agust at denx.de>
> Cc: Lukasz Majewski <lukma at denx.de>

Reviewed-by: Peng Fan <peng.fan at nxp.com>

> ---
>  drivers/clk/imx/clk-imx8qxp.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/clk/imx/clk-imx8qxp.c b/drivers/clk/imx/clk-imx8qxp.c
> index 1fca36a..0db4539 100644
> --- a/drivers/clk/imx/clk-imx8qxp.c
> +++ b/drivers/clk/imx/clk-imx8qxp.c
> @@ -56,18 +56,22 @@ ulong imx8_clk_get_rate(struct clk *clk)
>  		pm_clk = SC_PM_CLK_CPU;
>  		break;
>  	case IMX8QXP_I2C0_CLK:
> +	case IMX8QXP_I2C0_IPG_CLK:
>  		resource = SC_R_I2C_0;
>  		pm_clk = SC_PM_CLK_PER;
>  		break;
>  	case IMX8QXP_I2C1_CLK:
> +	case IMX8QXP_I2C1_IPG_CLK:
>  		resource = SC_R_I2C_1;
>  		pm_clk = SC_PM_CLK_PER;
>  		break;
>  	case IMX8QXP_I2C2_CLK:
> +	case IMX8QXP_I2C2_IPG_CLK:
>  		resource = SC_R_I2C_2;
>  		pm_clk = SC_PM_CLK_PER;
>  		break;
>  	case IMX8QXP_I2C3_CLK:
> +	case IMX8QXP_I2C3_IPG_CLK:
>  		resource = SC_R_I2C_3;
>  		pm_clk = SC_PM_CLK_PER;
>  		break;
> @@ -145,18 +149,22 @@ ulong imx8_clk_set_rate(struct clk *clk, unsigned
> long rate)
> 
>  	switch (clk->id) {
>  	case IMX8QXP_I2C0_CLK:
> +	case IMX8QXP_I2C0_IPG_CLK:
>  		resource = SC_R_I2C_0;
>  		pm_clk = SC_PM_CLK_PER;
>  		break;
>  	case IMX8QXP_I2C1_CLK:
> +	case IMX8QXP_I2C1_IPG_CLK:
>  		resource = SC_R_I2C_1;
>  		pm_clk = SC_PM_CLK_PER;
>  		break;
>  	case IMX8QXP_I2C2_CLK:
> +	case IMX8QXP_I2C2_IPG_CLK:
>  		resource = SC_R_I2C_2;
>  		pm_clk = SC_PM_CLK_PER;
>  		break;
>  	case IMX8QXP_I2C3_CLK:
> +	case IMX8QXP_I2C3_IPG_CLK:
>  		resource = SC_R_I2C_3;
>  		pm_clk = SC_PM_CLK_PER;
>  		break;
> @@ -234,18 +242,22 @@ int __imx8_clk_enable(struct clk *clk, bool enable)
> 
>  	switch (clk->id) {
>  	case IMX8QXP_I2C0_CLK:
> +	case IMX8QXP_I2C0_IPG_CLK:
>  		resource = SC_R_I2C_0;
>  		pm_clk = SC_PM_CLK_PER;
>  		break;
>  	case IMX8QXP_I2C1_CLK:
> +	case IMX8QXP_I2C1_IPG_CLK:
>  		resource = SC_R_I2C_1;
>  		pm_clk = SC_PM_CLK_PER;
>  		break;
>  	case IMX8QXP_I2C2_CLK:
> +	case IMX8QXP_I2C2_IPG_CLK:
>  		resource = SC_R_I2C_2;
>  		pm_clk = SC_PM_CLK_PER;
>  		break;
>  	case IMX8QXP_I2C3_CLK:
> +	case IMX8QXP_I2C3_IPG_CLK:
>  		resource = SC_R_I2C_3;
>  		pm_clk = SC_PM_CLK_PER;
>  		break;
> --
> 2.7.4
Stefano Babic Jan. 15, 2020, 12:47 p.m. UTC | #4
> Since commit d02be21d3004 ("i2c: imx_lpi2c: add ipg clk") getting
> I2C clocks doesn't work. Add I2C IPG clock IDs to related switch
> statements to fix it.
> Signed-off-by: Anatolij Gustschin <agust at denx.de>
> Cc: Lukasz Majewski <lukma at denx.de>
> Reviewed-by: Peng Fan <peng.fan at nxp.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/drivers/clk/imx/clk-imx8qxp.c b/drivers/clk/imx/clk-imx8qxp.c
index 1fca36a..0db4539 100644
--- a/drivers/clk/imx/clk-imx8qxp.c
+++ b/drivers/clk/imx/clk-imx8qxp.c
@@ -56,18 +56,22 @@  ulong imx8_clk_get_rate(struct clk *clk)
 		pm_clk = SC_PM_CLK_CPU;
 		break;
 	case IMX8QXP_I2C0_CLK:
+	case IMX8QXP_I2C0_IPG_CLK:
 		resource = SC_R_I2C_0;
 		pm_clk = SC_PM_CLK_PER;
 		break;
 	case IMX8QXP_I2C1_CLK:
+	case IMX8QXP_I2C1_IPG_CLK:
 		resource = SC_R_I2C_1;
 		pm_clk = SC_PM_CLK_PER;
 		break;
 	case IMX8QXP_I2C2_CLK:
+	case IMX8QXP_I2C2_IPG_CLK:
 		resource = SC_R_I2C_2;
 		pm_clk = SC_PM_CLK_PER;
 		break;
 	case IMX8QXP_I2C3_CLK:
+	case IMX8QXP_I2C3_IPG_CLK:
 		resource = SC_R_I2C_3;
 		pm_clk = SC_PM_CLK_PER;
 		break;
@@ -145,18 +149,22 @@  ulong imx8_clk_set_rate(struct clk *clk, unsigned long rate)
 
 	switch (clk->id) {
 	case IMX8QXP_I2C0_CLK:
+	case IMX8QXP_I2C0_IPG_CLK:
 		resource = SC_R_I2C_0;
 		pm_clk = SC_PM_CLK_PER;
 		break;
 	case IMX8QXP_I2C1_CLK:
+	case IMX8QXP_I2C1_IPG_CLK:
 		resource = SC_R_I2C_1;
 		pm_clk = SC_PM_CLK_PER;
 		break;
 	case IMX8QXP_I2C2_CLK:
+	case IMX8QXP_I2C2_IPG_CLK:
 		resource = SC_R_I2C_2;
 		pm_clk = SC_PM_CLK_PER;
 		break;
 	case IMX8QXP_I2C3_CLK:
+	case IMX8QXP_I2C3_IPG_CLK:
 		resource = SC_R_I2C_3;
 		pm_clk = SC_PM_CLK_PER;
 		break;
@@ -234,18 +242,22 @@  int __imx8_clk_enable(struct clk *clk, bool enable)
 
 	switch (clk->id) {
 	case IMX8QXP_I2C0_CLK:
+	case IMX8QXP_I2C0_IPG_CLK:
 		resource = SC_R_I2C_0;
 		pm_clk = SC_PM_CLK_PER;
 		break;
 	case IMX8QXP_I2C1_CLK:
+	case IMX8QXP_I2C1_IPG_CLK:
 		resource = SC_R_I2C_1;
 		pm_clk = SC_PM_CLK_PER;
 		break;
 	case IMX8QXP_I2C2_CLK:
+	case IMX8QXP_I2C2_IPG_CLK:
 		resource = SC_R_I2C_2;
 		pm_clk = SC_PM_CLK_PER;
 		break;
 	case IMX8QXP_I2C3_CLK:
+	case IMX8QXP_I2C3_IPG_CLK:
 		resource = SC_R_I2C_3;
 		pm_clk = SC_PM_CLK_PER;
 		break;