From: "Lothar Waßmann" <LW@KARO-electronics.de>
To: Martin Kaiser <martin@kaiser.cx>
Cc: Fabio Estevam <festevam@gmail.com>,
Stephen Boyd <sboyd@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
Sascha Hauer <kernel@pengutronix.de>,
Fabio Estevam <fabio.estevam@nxp.com>,
Shawn Guo <shawnguo@kernel.org>,
linux-clk <linux-clk@vger.kernel.org>,
"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] clk: imx25: set correct parents for ssi ipg clocks
Date: Fri, 9 Mar 2018 17:02:21 +0100 [thread overview]
Message-ID: <20180309170221.1c8bf8a1@karo-electronics.de> (raw)
In-Reply-To: <20180308164654.GA31199@botnar.kaiser.cx>
Hi,
On Thu, 8 Mar 2018 17:46:54 +0100 Martin Kaiser wrote:
> Hi Fabio,
>
> thanks for the quick response.
>
> Thus wrote Fabio Estevam (festevam@gmail.com):
>
> > Hi Martin,
>
> > On Thu, Mar 8, 2018 at 11:08 AM, Martin Kaiser <martin@kaiser.cx> wrote:
> > > Hi Fabio,
>
> > > Thus wrote Fabio Estevam (festevam@gmail.com):
>
> > >> I get audio working from SSI1, but I guess this is due to the fact
> > >> that the bootloader enables the SSI clock:
>
> > >> I have the following in U-Boot:
>
> > >> /* Enable the clocks */
> > >> DATA 4 0x53f8000c 0x1fffffff
> > >> DATA 4 0x53f80010 0xffffffff
> > >> DATA 4 0x53f80014 0xfdfff
>
> > > I'm using the same initial settings.
>
> > > Nevertheless, ssi1_ipg_per is disbled after loading the kernel.
>
> > > Digging into this a bit more, it turned out that without my patch,
> > > clk_disable_unused() recognizes ssi1_ipg_per as unused and disables it.
>
> > > If my patch is applied and ssi1_ipg_per is declared as parent of
> > > ssi1_ipg, clk_disable_unused() will not disable it and fsl_ssi_startup()
> > > will enable both ssi1_ipg_per and ssi1_ipg before playing sound.
>
> > I can get audio to work fine without your patch on a mx25pdk.
>
> this is surprising. How come the ssi1_ipg_per clock is not turned off by
> clk_disable_unused()? Where is it used? Do you have
>
> <&clks 55>
>
> anywhere in your DT?
>
> > In the other i.MX clock drivers we have this same pattern:
>
> > clks[IMX6SL_CLK_SSI1_IPG] = imx_clk_gate2_shared("ssi1_ipg", "ipg",
>
> It seems to the that imx25 uses a different clock hierarchy for ssi than other
> imx chips.
>
> Documentation/devicetree/bindings/clock/imx25-clock.txt: ssi1_ipg_per 55
> Documentation/devicetree/bindings/clock/imx25-clock.txt: ssi2_ipg_per 56
> Documentation/devicetree/bindings/clock/imx25-clock.txt: ssi1_ipg 117
> Documentation/devicetree/bindings/clock/imx25-clock.txt: ssi2_ipg 118
> Documentation/devicetree/bindings/clock/imx31-clock.txt: ssi1_gate 32
> Documentation/devicetree/bindings/clock/imx31-clock.txt: ssi2_gate 52
> Documentation/devicetree/bindings/clock/imx35-clock.txt: ssi_sel 22
> Documentation/devicetree/bindings/clock/imx35-clock.txt: ssi1_div_pre 23
> Documentation/devicetree/bindings/clock/imx35-clock.txt: ssi1_div_post 24
> Documentation/devicetree/bindings/clock/imx35-clock.txt: ssi2_div_pre 25
> Documentation/devicetree/bindings/clock/imx35-clock.txt: ssi2_div_post 26
> Documentation/devicetree/bindings/clock/imx35-clock.txt: ssi1_gate 68
> Documentation/devicetree/bindings/clock/imx35-clock.txt: ssi2_gate 69
>
> Others don't have ssiX_ipg_per.
>
> > It is not clear to me what is the real issue this patch is trying to fix.
>
> True. This needs clarification.
>
> I found that, in oder to get a tx clock out of the SSI, both ssi1_ipg_per and
> ssi1_ipg clocks must be active.
>
> The fsl_ssi driver only activates ssi1_ipg.
>
> If I activate ssi1_ipg_per in the bootloader, clk_disable_unused() deactivates it.
>
> (My codec chip does not use a dedicated clock line. It takes the bit clock that
> is the output of SSI. Are you maybe using ssi1_ipg_per for your codec and
> enable it there?)
>
> In my first mail, I was wondering about imx25 uart1, where we also have
> uart1_ipg and uart_ipg_per and the clock seeting is
>
> clk[uart1_ipg] = imx_clk_gate("uart1_ipg", "ipg", ccm(CCM_CGCR2), 14);
>
> In this case, both uart1 and uart_ipg_per are listed in the device tree
>
> uart1: serial@43f90000 {
> ...
> clocks = <&clks 120>, <&clks 57>;
> clock-names = "ipg", "per";
> };
>
> Documentation/devicetree/bindings/clock/imx25-clock.txt
> uart_ipg_per 57
> uart1_ipg 120
>
> and the driver enables both clocks explicitly. So they are not unused.
>
>
> Doing something like this is not an option for ssi, this will not work with
> imx31, 35 etc.
>
> Therefore, I suggest setting ssi1_ipg_per as parent of ssi1_ipg.
>
The right wayto fix this is to add the missing ipg_per clock to the DTB
rather than introducing a bogus clock relationship that doesn't exist
in hardware.
The sound/soc/fsl/fsl_ssi.c driver does already handle a second clock
as bitclock. It only needs to be specified in the DTB:
&ssi1 {
clocks = <&clks 117>, <&clk 55>;
clock-names = "ipg", "baud";
};
Lothar Waßmann
next prev parent reply other threads:[~2018-03-09 16:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-06 22:02 [PATCH] clk: imx25: set correct parents for ssi ipg clocks Martin Kaiser
2018-03-06 22:23 ` Fabio Estevam
2018-03-08 14:08 ` Martin Kaiser
2018-03-08 15:07 ` Fabio Estevam
2018-03-08 16:46 ` Martin Kaiser
2018-03-09 16:02 ` Lothar Waßmann [this message]
2018-03-10 2:37 ` Fabio Estevam
2018-03-11 16:39 ` Martin Kaiser
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=20180309170221.1c8bf8a1@karo-electronics.de \
--to=lw@karo-electronics.de \
--cc=fabio.estevam@nxp.com \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin@kaiser.cx \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
--cc=shawnguo@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).