From: shawnguo@kernel.org (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: mx6ul: Finding a good place to configure SAI2_MCLK
Date: Tue, 3 May 2016 20:42:03 +0800 [thread overview]
Message-ID: <20160503124203.GH5874@tiger> (raw)
In-Reply-To: <CAOMZO5CvT1rcHFPm6KoCBBgM1UACByLUQcJ_zDxY9ucbxCpgYA@mail.gmail.com>
On Mon, May 02, 2016 at 08:59:17PM -0300, Fabio Estevam wrote:
> Hi,
>
> In order to get audio working on imx6ul-evk board we need to enable
> the SAI2 MCLK clock by setting bit 20 (SAI2_MCLK_DIR) of the
> IOMUXC_GPR_GPR1 register.
>
> I am not sure where is the appropriate place to set this bit.
>
> Doing like this works fine:
>
> --- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
> +++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
> @@ -447,5 +447,6 @@
> #define IMX6UL_GPR1_ENET2_CLK_OUTPUT (0x1 << 18)
> #define IMX6UL_GPR1_ENET_CLK_DIR (0x3 << 17)
> #define IMX6UL_GPR1_ENET_CLK_OUTPUT (0x3 << 17)
> +#define IMX6UL_GPR1_SAI2_MCLK_DIR (0x1 << 20)
>
> index a38b16b..92cfb0f 100644
> --- a/arch/arm/mach-imx/mach-imx6ul.c
> +++ b/arch/arm/mach-imx/mach-imx6ul.c
> @@ -56,6 +56,19 @@ static inline void imx6ul_enet_init(void)
> imx6ul_enet_phy_init();
> }
>
> +static void __init imx6ul_mclk_init(void)
> +{
> + struct regmap *gpr;
> +
> + gpr = syscon_regmap_lookup_by_compatible("fsl,imx6ul-iomuxc-gpr");
> + if (!IS_ERR(gpr))
> + regmap_update_bits(gpr, IOMUXC_GPR1, IMX6UL_GPR1_SAI2_MCLK_DIR,
> + IMX6UL_GPR1_SAI2_MCLK_DIR);
> + else
> + pr_err("failed to find fsl,imx6ul-iomux-gpr regmap\n");
> +
> +}
> +
> static void __init imx6ul_init_machine(void)
> {
> struct device *parent;
> @@ -68,6 +81,7 @@ static void __init imx6ul_init_machine(void)
> imx6ul_enet_init();
> imx_anatop_init();
> imx6ul_pm_init();
> + imx6ul_mclk_init();
> }
>
> but it does not seem correct as this should be board specific. Should
> we call it only if the compatible string matches imx6sl-14x14-evk
> string? Looks like that will not scale as well.
>
> Currently in arch/arm/mach-imx/mach-imx6ul.c we also have
> imx6ul_enet_clk_init() function which sets the ENET_CLK in the GPR1
> register.
>
> IMHO this is not correct because not all mx6ul boards need such clock
> and then we need to change this too.
>
> So where should we set the SAI2_MCLK_DIR bit of GPR1? Inside the SAI driver?
To me, it's the best if we can handle this in SAI driver.
Shawn
>
> Appreciate some feedback.
>
> Thanks,
>
> Fabio Estevam
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2016-05-03 12:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-02 23:59 mx6ul: Finding a good place to configure SAI2_MCLK Fabio Estevam
2016-05-03 12:42 ` Shawn Guo [this message]
2016-05-03 19:52 ` Nicolin Chen
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=20160503124203.GH5874@tiger \
--to=shawnguo@kernel.org \
--cc=linux-arm-kernel@lists.infradead.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).