From patchwork Fri Mar 4 15:41:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 609431 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p24Fg7M6003392 for ; Fri, 4 Mar 2011 15:42:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759780Ab1CDPmF (ORCPT ); Fri, 4 Mar 2011 10:42:05 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:27370 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759644Ab1CDPmD (ORCPT ); Fri, 4 Mar 2011 10:42:03 -0500 Received: from eu_spt1 (mailout2.w1.samsung.com [210.118.77.12]) by mailout2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0LHJ00K90IA2GT@mailout2.w1.samsung.com>; Fri, 04 Mar 2011 15:42:02 +0000 (GMT) Received: from linux.samsung.com ([106.116.38.10]) by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LHJ00JCDIA1EC@spt1.w1.samsung.com>; Fri, 04 Mar 2011 15:42:01 +0000 (GMT) Received: from localhost.localdomain (smtp.w1.samsung.com [106.116.38.10]) by linux.samsung.com (Postfix) with ESMTP id 23C2B270059; Fri, 04 Mar 2011 16:42:44 +0100 (CET) Date: Fri, 04 Mar 2011 16:41:49 +0100 From: Tomasz Stanislawski Subject: [PATCH 1/6] i2c-s3c2410: fix I2C dedicated for hdmiphy In-reply-to: <1299253314-10065-1-git-send-email-t.stanislaws@samsung.com> To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: kgene.kim@samsung.com, m.szyprowski@samsung.com, t.stanislaws@samsung.com, kyungmin.park@samsung.com, ben-linux@fluff.org Message-id: <1299253314-10065-2-git-send-email-t.stanislaws@samsung.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.2.3 Content-type: TEXT/PLAIN Content-transfer-encoding: 7BIT References: <1299253314-10065-1-git-send-email-t.stanislaws@samsung.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 04 Mar 2011 15:42:25 +0000 (UTC) diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 6c00c10..99cfe2f 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -54,6 +54,7 @@ enum s3c24xx_i2c_state { enum s3c24xx_i2c_type { TYPE_S3C2410, TYPE_S3C2440, + TYPE_S3C2440_HDMIPHY, }; struct s3c24xx_i2c { @@ -96,7 +97,21 @@ static inline int s3c24xx_i2c_is2440(struct s3c24xx_i2c *i2c) enum s3c24xx_i2c_type type; type = platform_get_device_id(pdev)->driver_data; - return type == TYPE_S3C2440; + return type == TYPE_S3C2440 || type == TYPE_S3C2440_HDMIPHY; +} + +/* s3c24xx_i2c_is2440_hdmiphy() + * + * return true is this is an s3c2440 dedicated for HDMIPHY interface +*/ + +static inline int s3c24xx_i2c_is2440_hdmiphy(struct s3c24xx_i2c *i2c) +{ + struct platform_device *pdev = to_platform_device(i2c->dev); + enum s3c24xx_i2c_type type; + + type = platform_get_device_id(pdev)->driver_data; + return type == TYPE_S3C2440_HDMIPHY; } /* s3c24xx_i2c_master_complete @@ -461,6 +476,13 @@ static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c) unsigned long iicstat; int timeout = 400; + /* if hang-up of HDMIPHY occured reduce timeout + * The controller will work after reset, so waiting + * 400 ms will cause unneccessary system hangup + */ + if (s3c24xx_i2c_is2440_hdmiphy(i2c)) + timeout = 10; + while (timeout-- > 0) { iicstat = readl(i2c->regs + S3C2410_IICSTAT); @@ -470,6 +492,15 @@ static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c) msleep(1); } + /* hang-up of bus dedicated for HDMIPHY occured, resetting */ + if (s3c24xx_i2c_is2440_hdmiphy(i2c)) { + writel(0, i2c->regs + S3C2410_IICCON); + writel(0, i2c->regs + S3C2410_IICSTAT); + writel(0, i2c->regs + S3C2410_IICDS); + + return 0; + } + return -ETIMEDOUT; } @@ -1009,6 +1040,9 @@ static struct platform_device_id s3c24xx_driver_ids[] = { }, { .name = "s3c2440-i2c", .driver_data = TYPE_S3C2440, + }, { + .name = "s3c2440-hdmiphy-i2c", + .driver_data = TYPE_S3C2440_HDMIPHY, }, { }, }; MODULE_DEVICE_TABLE(platform, s3c24xx_driver_ids);