From patchwork Tue Mar 31 12:43:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Grandegger X-Patchwork-Id: 25402 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id BA7095F5DE for ; Tue, 31 Mar 2009 23:48:12 +1100 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by ozlabs.org (Postfix) with ESMTP id 200F4DE291; Tue, 31 Mar 2009 23:43:50 +1100 (EST) Received: from mail01.m-online.net (mail.m-online.net [192.168.3.149]) by mail-out.m-online.net (Postfix) with ESMTP id 23D3D1C02165; Tue, 31 Mar 2009 14:43:46 +0200 (CEST) X-Auth-Info: BgQRJFbQnCDgV/re75FVOOJ+yLB095FzmFG5HkUVE4s= Received: from mail.denx.de (host-82-135-33-74.customer.m-online.net [82.135.33.74]) by smtp-auth.mnet-online.de (Postfix) with ESMTP id A13D990141; Tue, 31 Mar 2009 14:43:48 +0200 (CEST) Received: from pollux.denx.de (pollux [192.168.1.1]) by mail.denx.de (Postfix) with ESMTP id 7D19642D7B03; Tue, 31 Mar 2009 14:43:48 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 504) id 7008310117BBA; Tue, 31 Mar 2009 14:43:48 +0200 (CEST) Message-Id: <20090331124348.330571158@denx.de> User-Agent: quilt/0.47-1 Date: Tue, 31 Mar 2009 14:43:39 +0200 From: Wolfgang Grandegger To: linuxppc-dev@ozlabs.org Subject: [PATCH 1/2] powerpc: i2c-mpc: preserve I2C clocking References: <20090331124338.531903515@denx.de> Content-Disposition: inline; filename=i2c-mpc-preserver-clocking.patch Cc: devicetree-discuss@ozlabs.org X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org The I2c node property "fsl,preserve-clocking" allows to overtake the clock settings from the boot loader and avoids the hard-coded setting. Signed-off-by: Wolfgang Grandegger --- drivers/i2c/busses/i2c-mpc.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) Index: linux-2.6/drivers/i2c/busses/i2c-mpc.c =================================================================== --- linux-2.6.orig/drivers/i2c/busses/i2c-mpc.c 2009-03-31 13:25:08.000000000 +0200 +++ linux-2.6/drivers/i2c/busses/i2c-mpc.c 2009-03-31 13:28:03.000000000 +0200 @@ -318,17 +318,24 @@ { int result = 0; struct mpc_i2c *i2c; + int set_clock; i2c = kzalloc(sizeof(*i2c), GFP_KERNEL); if (!i2c) return -ENOMEM; - if (of_get_property(op->node, "dfsrr", NULL)) - i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR; - - if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") || - of_device_is_compatible(op->node, "mpc5200-i2c")) - i2c->flags |= FSL_I2C_DEV_CLOCK_5200; + if (of_get_property(op->node, "fsl,preserve-clocking", NULL)) { + set_clock = 0; + } else { + set_clock = 1; + + if (of_get_property(op->node, "dfsrr", NULL)) + i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR; + + if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") || + of_device_is_compatible(op->node, "mpc5200-i2c")) + i2c->flags |= FSL_I2C_DEV_CLOCK_5200; + } init_waitqueue_head(&i2c->queue); @@ -348,8 +355,9 @@ goto fail_request; } } - - mpc_i2c_setclock(i2c); + + if (set_clock) + mpc_i2c_setclock(i2c); dev_set_drvdata(&op->dev, i2c);