From patchwork Thu Jul 5 08:42:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ruslan Bilovol X-Patchwork-Id: 1158611 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id CFC863FE4F for ; Thu, 5 Jul 2012 08:42:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752976Ab2GEImL (ORCPT ); Thu, 5 Jul 2012 04:42:11 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:45238 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752594Ab2GEImC (ORCPT ); Thu, 5 Jul 2012 04:42:02 -0400 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id q658g1mL005613; Thu, 5 Jul 2012 03:42:01 -0500 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q658g1Ko006213; Thu, 5 Jul 2012 03:42:01 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Thu, 5 Jul 2012 03:42:01 -0500 Received: from localhost (uglx0155540.ucm2.emeaucm.ext.ti.com [10.167.145.75]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id q658g0Ti030235; Thu, 5 Jul 2012 03:42:01 -0500 From: Ruslan Bilovol To: , , Subject: [PATCH 1/2] OMAP4: otg: phy: fix charger detection Date: Thu, 5 Jul 2012 11:42:00 +0300 Message-ID: <1341477720-6771-1-git-send-email-ruslan.bilovol@ti.com> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Charger detection feature is not correctly used and thus makes some regressions if OTG was used in the host mode. Charger detection takes 500 ms so if some device is attached to the host after 500 ms it will be suddenly resetted. This feature is enabled by default after reset/cold boot so always affects PHY usage. So finally this was wrongly interpreted as "phy requires 200ms to start". After fixing this we can safely remove uggly mdelay after powering on the PHY. Signed-off-by: Ruslan Bilovol --- arch/arm/mach-omap2/omap_phy_internal.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c index d52651a..a13a37c 100644 --- a/arch/arm/mach-omap2/omap_phy_internal.c +++ b/arch/arm/mach-omap2/omap_phy_internal.c @@ -42,12 +42,16 @@ #define SESSEND BIT(3) #define IDDIG BIT(4) +#define CONTROL_USB2PHYCORE 0x620 +#define USB2PHY_DISCHGDET BIT(30) + static struct clk *phyclk, *clk48m, *clk32k; static void __iomem *ctrl_base; static int usbotghs_control; int omap4430_phy_init(struct device *dev) { + u32 usb2phycore; ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K); if (!ctrl_base) { pr_err("control module ioremap failed\n"); @@ -56,6 +60,11 @@ int omap4430_phy_init(struct device *dev) /* Power down the phy */ __raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF); + /* Disable charger detection by default */ + usb2phycore = omap4_ctrl_pad_readl(CONTROL_USB2PHYCORE); + usb2phycore |= USB2PHY_DISCHGDET; + omap4_ctrl_pad_writel(usb2phycore, CONTROL_USB2PHYCORE); + if (!dev) { iounmap(ctrl_base); return 0;