From patchwork Mon May 2 23:59:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 617719 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qzLtK0QRJz9sdb for ; Tue, 3 May 2016 10:01:13 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=vEJzq77+; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1axNkb-0004Zg-1e; Mon, 02 May 2016 23:59:41 +0000 Received: from mail-io0-x22e.google.com ([2607:f8b0:4001:c06::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1axNkY-0004VB-Aa for linux-arm-kernel@lists.infradead.org; Mon, 02 May 2016 23:59:38 +0000 Received: by mail-io0-x22e.google.com with SMTP id d62so7742033iof.2 for ; Mon, 02 May 2016 16:59:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc; bh=F+7lTVU1fraTaFnvwU4KHBZiVxCQfYLfn7UyAU1NjQA=; b=vEJzq77+qxi7skRGizy8fIWUHE16sxvs06cH97zH0uJG8caosRtqrPg+5UHkJooPcu TZS1qtiJqIHlZRy/Ml24dLKbRfAC7IGPDST2+mQDJZd/I6mabhjEHWDsdOqBzYssJWQ5 LLit/H+3fUPUslVYkpyL3rpTDfsK3ptXW0lzuDv74lesvOgRWh/s/iG5+G/3J9pPvjZl nBU18N3uJU2HjwZGswtadFQ9f+bG5syUrfXnjn6l5pZHKH8JNYfoIMj75DNag0jLobxw KeQIddmx2C+2xMNZix0bi/pPWdKu2ym06p33LQ2xPZvZlvAf1MzR4/JLxa8YLUHfr/lE SoZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc; bh=F+7lTVU1fraTaFnvwU4KHBZiVxCQfYLfn7UyAU1NjQA=; b=W6S1S8O/uMv8qwOiFyp4cm8sho8w8G9ILF95K650DicaEHPtCH8WGm/GI+dJSqkik8 afHL8hqREcai7KLf4SY9w+VE0NqGNj07qAG6eQ6ITENCCPI3c5SkNEjax8A4nywBFRmF m5g4E91wslFJ8PhVldqy2xA3u2IHGtoCMxDkY9gzmz4yKgzpAUq9Fkm52w+CVUtg/Lzi tKv6uuodqAWpuX6BGpdhQCpvHtUCyGJazcNscnuKq+qTJvwOQGmsT+9geXibMfgQSLzy J5Epy5yf8ij+vDYFIEZuhgt0iUuE9NRzfogMrBAX6gUc9MO7X+NxrL5pTIzcZq/tDGp+ 1p4w== X-Gm-Message-State: AOPr4FXZ99iZXGKJaaV98sGWViDVE4o5BJgKPtfZzWVMynPrjvKEYcdhwrQFiFFXQGWScBkWtKeAY3imW9MbEA== MIME-Version: 1.0 X-Received: by 10.107.33.7 with SMTP id h7mr43143323ioh.30.1462233557259; Mon, 02 May 2016 16:59:17 -0700 (PDT) Received: by 10.79.101.194 with HTTP; Mon, 2 May 2016 16:59:17 -0700 (PDT) Date: Mon, 2 May 2016 20:59:17 -0300 Message-ID: Subject: mx6ul: Finding a good place to configure SAI2_MCLK From: Fabio Estevam To: Shawn Guo , Sascha Hauer X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160502_165938_412820_A8B250EE X-CRM114-Status: GOOD ( 12.35 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:4001:c06:0:0:0:22e listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (festevam[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicolin Chen , "linux-arm-kernel@lists.infradead.org" , Petr Kulhavy Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org 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: 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? Appreciate some feedback. Thanks, Fabio Estevam --- 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