public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Oliver Graute <oliver.graute@gmail.com>
To: u-boot@lists.denx.de
Subject: I2C on imx8qm - Failed to enable ipg clk
Date: Thu, 12 Nov 2020 11:37:30 +0100	[thread overview]
Message-ID: <20201112103730.GA17101@optiplex> (raw)
In-Reply-To: <20200810071822.GB66637@archlinux.localdomain>

On 10/08/20, Oliver Graute wrote:
> On 05/08/20, Anatolij Gustschin wrote:
> > Hi Oliver,
> > 
> > On Wed, 5 Aug 2020 15:47:07 +0200
> > Oliver Graute oliver.graute at gmail.com wrote:
> > 
> > > Hello,
> > > 
> > > I try to get my I2C working on imx8qm. But I run into this issue:
> > > 
> > > => i2c bus  
> > > Bus 3:  i2c at 5a830000
> > > => i2c dev 3  
> > > Setting bus to 3
> > > Failed to enable ipg clk
> > > Failure changing bus number (-524)
> > > 
> > > Some idea how to fix that?
> > > 
> > > I'am using U-Boot 2020.04
> > 
> > I think the clock driver (in drivers/clk/imx/clk-imx8qm.c) does not
> > have support for IMX8QM_I2C*_IPG_CLK clocks yet.
> 
> ok, what I have to do to add support for it? just adding
> IMX8QM_I2C*_IPG_CLK to the imx8_clk_names[]?

ok I solved this issue this way:

diff --git a/drivers/clk/imx/clk-imx8qm.c b/drivers/clk/imx/clk-imx8qm.c
index 54fb09fda4..7e466d630a 100644
--- a/drivers/clk/imx/clk-imx8qm.c
+++ b/drivers/clk/imx/clk-imx8qm.c
@@ -53,19 +53,27 @@ ulong imx8_clk_get_rate(struct clk *clk)
 		resource = SC_R_A53;
 		pm_clk = SC_PM_CLK_CPU;
 		break;
+	case IMX8QM_I2C0_IPG_CLK:
 	case IMX8QM_I2C0_CLK:
+	case IMX8QM_I2C0_DIV:
 		resource = SC_R_I2C_0;
 		pm_clk = SC_PM_CLK_PER;
 		break;
+	case IMX8QM_I2C1_IPG_CLK:
 	case IMX8QM_I2C1_CLK:
+	case IMX8QM_I2C1_DIV:
 		resource = SC_R_I2C_1;
 		pm_clk = SC_PM_CLK_PER;
 		break;
+	case IMX8QM_I2C2_IPG_CLK:
 	case IMX8QM_I2C2_CLK:
+	case IMX8QM_I2C2_DIV:
 		resource = SC_R_I2C_2;
 		pm_clk = SC_PM_CLK_PER;
 		break;
+	case IMX8QM_I2C3_IPG_CLK:
 	case IMX8QM_I2C3_CLK:
+	case IMX8QM_I2C3_DIV:
 		resource = SC_R_I2C_3;
 		pm_clk = SC_PM_CLK_PER;
 		break;
@@ -148,19 +156,27 @@ ulong imx8_clk_set_rate(struct clk *clk, unsigned long rate)
 	debug("%s(#%lu), rate: %lu\n", __func__, clk->id, rate);
 
 	switch (clk->id) {
+	case IMX8QM_I2C0_IPG_CLK:
 	case IMX8QM_I2C0_CLK:
+	case IMX8QM_I2C0_DIV:
 		resource = SC_R_I2C_0;
 		pm_clk = SC_PM_CLK_PER;
 		break;
+	case IMX8QM_I2C1_IPG_CLK:
 	case IMX8QM_I2C1_CLK:
+	case IMX8QM_I2C1_DIV:
 		resource = SC_R_I2C_1;
 		pm_clk = SC_PM_CLK_PER;
 		break;
+	case IMX8QM_I2C2_IPG_CLK:
 	case IMX8QM_I2C2_CLK:
+	case IMX8QM_I2C2_DIV:
 		resource = SC_R_I2C_2;
 		pm_clk = SC_PM_CLK_PER;
 		break;
+	case IMX8QM_I2C3_IPG_CLK:
 	case IMX8QM_I2C3_CLK:
+	case IMX8QM_I2C3_DIV:
 		resource = SC_R_I2C_3;
 		pm_clk = SC_PM_CLK_PER;
 		break;
@@ -242,19 +258,27 @@ int __imx8_clk_enable(struct clk *clk, bool enable)
 	debug("%s(#%lu)\n", __func__, clk->id);
 
 	switch (clk->id) {
+	case IMX8QM_I2C0_IPG_CLK:
 	case IMX8QM_I2C0_CLK:
+	case IMX8QM_I2C0_DIV:
 		resource = SC_R_I2C_0;
 		pm_clk = SC_PM_CLK_PER;
 		break;
+	case IMX8QM_I2C1_IPG_CLK:
 	case IMX8QM_I2C1_CLK:
+	case IMX8QM_I2C1_DIV:
 		resource = SC_R_I2C_1;
 		pm_clk = SC_PM_CLK_PER;
 		break;
+	case IMX8QM_I2C2_IPG_CLK:
 	case IMX8QM_I2C2_CLK:
+	case IMX8QM_I2C2_DIV:
 		resource = SC_R_I2C_2;
 		pm_clk = SC_PM_CLK_PER;
 		break;
+	case IMX8QM_I2C3_IPG_CLK:
 	case IMX8QM_I2C3_CLK:
+	case IMX8QM_I2C3_DIV:
 		resource = SC_R_I2C_3;
 		pm_clk = SC_PM_CLK_PER;
 		break;

Best regards,

Oliver
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-keys
Size: 3829 bytes
Desc: PGP-Schl?ssel 0x00C0A76606F3A5480813234EEF50CD4BA60B1294.
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201112/cf07360b/attachment.key>

      reply	other threads:[~2020-11-12 10:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-05 13:47 I2C on imx8qm - Failed to enable ipg clk Oliver Graute
2020-08-05 14:50 ` Anatolij Gustschin
2020-08-10  7:18   ` Oliver Graute
2020-11-12 10:37     ` Oliver Graute [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201112103730.GA17101@optiplex \
    --to=oliver.graute@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox