Patchwork [v2,09/12] ARM: imx6q: disable usb charger detector

login
register
mail settings
Submitter Richard Zhao
Date May 21, 2012, 9:23 a.m.
Message ID <1337592237-5090-10-git-send-email-richard.zhao@freescale.com>
Download mbox | patch
Permalink /patch/160344/
State New
Headers show

Comments

Richard Zhao - May 21, 2012, 9:23 a.m.
The external charger detector needs to be disabled,
or the signal at DP will be poor

Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
---
 arch/arm/mach-imx/mach-imx6q.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
Shawn Guo - May 22, 2012, 3:48 a.m.
On Mon, May 21, 2012 at 05:23:54PM +0800, Richard Zhao wrote:
> +static void __init imx6q_usb_init(void)
> +{
> +#define HW_ANADIG_USB1_CHRG_DETECT		0x000001b0
> +#define HW_ANADIG_USB2_CHRG_DETECT		0x00000210
> +
> +#define BM_ANADIG_USB_CHRG_DETECT_EN_B		0x00100000
> +#define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B	0x00080000
> +
> +	/*
> +	 * The external charger detector needs to be disabled,
> +	 * or the signal at DP will be poor
> +	 */
> +
Nit: drop this unnecessary new line.

Regards,
Shawn

> +	anatop_write_reg(NULL, HW_ANADIG_USB1_CHRG_DETECT,
> +			BM_ANADIG_USB_CHRG_DETECT_EN_B
> +			| BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B,
> +			~0);
> +	anatop_write_reg(NULL, HW_ANADIG_USB2_CHRG_DETECT,
> +			BM_ANADIG_USB_CHRG_DETECT_EN_B |
> +			BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B,
> +			~0);
> +}
> +
Richard Zhao - May 22, 2012, 4:32 a.m.
On Tue, May 22, 2012 at 11:48:11AM +0800, Shawn Guo wrote:
> On Mon, May 21, 2012 at 05:23:54PM +0800, Richard Zhao wrote:
> > +static void __init imx6q_usb_init(void)
> > +{
> > +#define HW_ANADIG_USB1_CHRG_DETECT		0x000001b0
> > +#define HW_ANADIG_USB2_CHRG_DETECT		0x00000210
> > +
> > +#define BM_ANADIG_USB_CHRG_DETECT_EN_B		0x00100000
> > +#define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B	0x00080000
> > +
> > +	/*
> > +	 * The external charger detector needs to be disabled,
> > +	 * or the signal at DP will be poor
> > +	 */
> > +
> Nit: drop this unnecessary new line.
OK. 

Thanks
Richard
> 
> Regards,
> Shawn
> 
> > +	anatop_write_reg(NULL, HW_ANADIG_USB1_CHRG_DETECT,
> > +			BM_ANADIG_USB_CHRG_DETECT_EN_B
> > +			| BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B,
> > +			~0);
> > +	anatop_write_reg(NULL, HW_ANADIG_USB2_CHRG_DETECT,
> > +			BM_ANADIG_USB_CHRG_DETECT_EN_B |
> > +			BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B,
> > +			~0);
> > +}
> > +
>

Patch

diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 577cf19..0bfd8c7 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -25,6 +25,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>
@@ -141,9 +142,33 @@  static void __init imx6q_config_on_boot(void)
 	of_node_put(np);
 }
 
+static void __init imx6q_usb_init(void)
+{
+#define HW_ANADIG_USB1_CHRG_DETECT		0x000001b0
+#define HW_ANADIG_USB2_CHRG_DETECT		0x00000210
+
+#define BM_ANADIG_USB_CHRG_DETECT_EN_B		0x00100000
+#define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B	0x00080000
+
+	/*
+	 * The external charger detector needs to be disabled,
+	 * or the signal at DP will be poor
+	 */
+
+	anatop_write_reg(NULL, HW_ANADIG_USB1_CHRG_DETECT,
+			BM_ANADIG_USB_CHRG_DETECT_EN_B
+			| BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B,
+			~0);
+	anatop_write_reg(NULL, HW_ANADIG_USB2_CHRG_DETECT,
+			BM_ANADIG_USB_CHRG_DETECT_EN_B |
+			BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B,
+			~0);
+}
+
 static void __init imx6q_post_populate(void)
 {
 	imx6q_config_on_boot();
+	imx6q_usb_init();
 }
 
 static void __init imx6q_init_machine(void)