linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: richard.zhao@freescale.com (Richard Zhao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v1 6/7] ARM: imx6q: add anatop initialization for usb controllers
Date: Tue, 15 May 2012 21:58:22 +0800	[thread overview]
Message-ID: <1337090303-16046-7-git-send-email-richard.zhao@freescale.com> (raw)
In-Reply-To: <1337090303-16046-1-git-send-email-richard.zhao@freescale.com>

Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
---
 arch/arm/mach-imx/mach-imx6q.c |   60 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 74e44d3..4530c45 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -22,6 +22,7 @@
 #include <linux/pinctrl/machine.h>
 #include <linux/phy.h>
 #include <linux/micrel_phy.h>
+#include <linux/mfd/anatop.h>
 #include <asm/smp_twd.h>
 #include <asm/hardware/cache-l2x0.h>
 #include <asm/hardware/gic.h>
@@ -82,6 +83,63 @@ static void __init imx6q_sabrelite_init(void)
 				ksz9021rn_phy_fixup);
 }
 
+static void __init imx6q_post_populate(void)
+{
+	u32 val;
+
+#define HW_ANADIG_USB2_CHRG_DETECT	(0x00000210)
+#define BM_ANADIG_USB2_CHRG_DETECT_EN_B 0x00100000
+#define BM_ANADIG_USB2_CHRG_DETECT_CHK_CHRG_B 0x00080000
+
+#define HW_ANADIG_USB2_PLL_480_CTRL	(0x00000020)
+#define BM_ANADIG_USB2_PLL_480_CTRL_BYPASS 0x00010000
+#define BM_ANADIG_USB2_PLL_480_CTRL_ENABLE 0x00002000
+#define BM_ANADIG_USB2_PLL_480_CTRL_POWER 0x00001000
+#define BM_ANADIG_USB2_PLL_480_CTRL_EN_USB_CLKS 0x00000040
+
+	/* Some phy and power's special controls for host1
+	 * 1. The external charger detector needs to be disabled
+	 * or the signal at DP will be poor
+	 * 2. The PLL's power and output to usb for host 1
+	 * is totally controlled by IC, so the Software only needs
+	 * to enable them at initializtion.
+	 */
+
+	anatop_write_reg(NULL, HW_ANADIG_USB2_CHRG_DETECT,
+			BM_ANADIG_USB2_CHRG_DETECT_EN_B |
+			BM_ANADIG_USB2_CHRG_DETECT_CHK_CHRG_B,
+			~0);
+	anatop_write_reg(NULL, HW_ANADIG_USB2_PLL_480_CTRL, 0,
+			BM_ANADIG_USB2_PLL_480_CTRL_BYPASS);
+
+	val = BM_ANADIG_USB2_PLL_480_CTRL_ENABLE |
+	      BM_ANADIG_USB2_PLL_480_CTRL_POWER |
+	      BM_ANADIG_USB2_PLL_480_CTRL_EN_USB_CLKS;
+	anatop_write_reg(NULL, HW_ANADIG_USB2_PLL_480_CTRL, val, val);
+
+	/* Some phy and power's special controls for otg
+	 * 1. The external charger detector needs to be disabled
+	 * or the signal at DP will be poor
+	 * 2. The EN_USB_CLKS is always enabled.
+	 * The PLL's power is controlled by usb and others who
+	 * use pll3 too.
+	 */
+#define HW_ANADIG_USB1_CHRG_DETECT      (0x000001b0)
+#define BM_ANADIG_USB1_CHRG_DETECT_EN_B 0x00100000
+#define BM_ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B 0x00080000
+
+#define HW_ANADIG_USB1_PLL_480_CTRL     (0x00000010)
+#define BM_ANADIG_USB1_PLL_480_CTRL_EN_USB_CLKS 0x00000040
+
+	anatop_write_reg(NULL, HW_ANADIG_USB1_CHRG_DETECT,
+			BM_ANADIG_USB1_CHRG_DETECT_EN_B
+			| BM_ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B,
+			~0);
+	anatop_write_reg(NULL, HW_ANADIG_USB1_PLL_480_CTRL,
+			BM_ANADIG_USB1_PLL_480_CTRL_EN_USB_CLKS,
+			BM_ANADIG_USB1_PLL_480_CTRL_EN_USB_CLKS);
+}
+
 static void __init imx6q_init_machine(void)
 {
 	/*
@@ -95,6 +153,8 @@ static void __init imx6q_init_machine(void)
 
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 
+	imx6q_post_populate();
+
 	imx6q_pm_init();
 }
 
-- 
1.7.5.4

  parent reply	other threads:[~2012-05-15 13:58 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-15 13:58 [PATCH v1 0/7] preliminary work for adding imx6q_sabrelite usb support Richard Zhao
2012-05-15 13:58 ` [PATCH v1 1/7] usb: chipidea: permit user select USB_EHCI_ROOT_HUB_TT Richard Zhao
2012-05-15 14:27   ` Marek Vasut
2012-05-15 15:19     ` Greg KH
2012-05-16  1:03   ` Marek Vasut
2012-05-15 13:58 ` [PATCH v1 2/7] usb: chipidea: remove zero check of hw_ep_max Richard Zhao
2012-05-16  1:11   ` Marek Vasut
2012-05-16  1:14   ` [PATCH] usb: chipidea: improve the validation of endpoint count Marek Vasut
2012-05-16 11:11     ` Alexander Shishkin
2012-05-16  5:32   ` [PATCH v1 2/7] usb: chipidea: remove zero check of hw_ep_max Peter Chen
2012-05-16  5:46     ` Richard Zhao
2012-05-16 10:48     ` Alexander Shishkin
2012-05-15 13:58 ` [PATCH v1 3/7] usb: chipidea: add imx on-soc utmi phy driver Richard Zhao
2012-05-16  1:20   ` Marek Vasut
2012-05-15 13:58 ` [PATCH v1 4/7] usb: chipidea: add imx driver binding Richard Zhao
2012-05-15 14:03   ` Russell King - ARM Linux
2012-05-15 14:12     ` Richard Zhao
2012-05-16  8:36     ` Richard Zhao
2012-05-16  1:22   ` Marek Vasut
2012-05-16 11:38   ` Alexander Shishkin
2012-05-16 11:58     ` Felipe Balbi
2012-05-16 13:08     ` Richard Zhao
2012-05-16 14:18       ` Alexander Shishkin
2012-05-17  2:41         ` Richard Zhao
2012-05-15 13:58 ` [PATCH v1 5/7] ARM: imx6q: correct device name of usbphy and usboh3 clock export Richard Zhao
2012-05-15 13:58 ` Richard Zhao [this message]
2012-05-15 13:58 ` [PATCH v1 7/7] ARM: dts: imx6q-sabrelite: add usb devices Richard Zhao
2012-05-15 14:28 ` [PATCH v1 0/7] preliminary work for adding imx6q_sabrelite usb support Marek Vasut
2012-05-15 15:21   ` Greg KH
2012-05-15 16:30     ` Marek Vasut
2012-05-16  0:37       ` Richard Zhao
2012-05-16  8:34         ` Peter Chen
2012-05-16 13:22           ` Marek Vasut
2012-05-16 15:05             ` Shawn Guo

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=1337090303-16046-7-git-send-email-richard.zhao@freescale.com \
    --to=richard.zhao@freescale.com \
    --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).