From patchwork Wed Aug 8 13:11:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 1295371 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id A546ADF223 for ; Wed, 8 Aug 2012 13:14:55 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Sz63W-000859-40; Wed, 08 Aug 2012 13:12:10 +0000 Received: from mail-ey0-f177.google.com ([209.85.215.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Sz63Q-000831-Nz for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2012 13:12:05 +0000 Received: by eaai12 with SMTP id i12so218517eaa.36 for ; Wed, 08 Aug 2012 06:12:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :x-gm-message-state; bh=u6tMDc/U6sd1vGtldraEQUoBRG9mObD5Kcd4JNX+Yak=; b=UvipQo7PZPCwr2xKrdftfFi2pkfyLByeIijAvOiB4GUvjSDjG1nJ+ii9mFA4jt/jja gyypvZigYAk6sxfGAP30BOaZ1YUG+94D0Y/s5k+JgAaGWv0BH9PmpmKDSaVHWp3uKqP/ JP2XrNvmihDU6uVEzF2pqJaWXLNct2yOTIbV8wvWtu/W3cFsp/XLwqzmkxnzExvM0bNw RHPkrZbNMn4LHcwAHYXaZ82zBHVhG/CGZwBpAiAanUhZgdQkn5ZsndyKAXXxiaqWZSfs dWkrXvYPYbWARlzoaiJeln9vF71FzhP0UaixvdN8zK0f+v8LtxKJ3HSTokklwR6jY4dE kJSw== Received: by 10.14.214.196 with SMTP id c44mr22384848eep.7.1344431522837; Wed, 08 Aug 2012 06:12:02 -0700 (PDT) Received: from gmail.com (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id h2sm21739528eeo.3.2012.08.08.06.12.01 (version=SSLv3 cipher=OTHER); Wed, 08 Aug 2012 06:12:02 -0700 (PDT) Date: Wed, 8 Aug 2012 14:11:59 +0100 From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/1 v4] i2c: Add default configuration into the Nomadik I2C driver. Message-ID: <20120808131158.GD8227@gmail.com> References: <1344266253-14050-1-git-send-email-lee.jones@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1344266253-14050-1-git-send-email-lee.jones@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQkM1M+5tMudCto/+CqREr6Ih7o5dv+Gloo+G5jBsGxb3crAXjFd12+CmqM0/03E7aFKciuo X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.177 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: STEricsson_nomadik_linux@list.st.com, linux-i2c@vger.kernel.org, linus.walleij@stericsson.com, arnd@arndb.de, w.sang@pengutronix.de X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Lee Jones Date: Tue, 7 Aug 2012 12:27:24 +0100 Subject: [PATCH 1/1 v4] i2c/nomadik: Add default configuration into the Nomadik I2C driver At this moment in time there is only one known configuration for the Nomadik I2C driver. By not holding that configuration in the driver adds some unnecessary overhead in platform code. The configuration as already been removed from platform code, this patch checks for any over-riding configurations. If there aren't any, the default is used. Cc: linux-i2c@vger.kernel.org Acked-by: srinidhi kasagar Acked-by: Linus Walleij Signed-off-by: Lee Jones --- drivers/i2c/busses/i2c-nomadik.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 5e6f1ee..61b00ed 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -350,10 +350,6 @@ static void setup_i2c_controller(struct nmk_i2c_dev *dev) i2c_clk = clk_get_rate(dev->clk); - /* fallback to std. mode if machine has not provided it */ - if (dev->cfg.clk_freq == 0) - dev->cfg.clk_freq = 100000; - /* * The spec says, in case of std. mode the divider is * 2 whereas it is 3 for fast and fastplus mode of @@ -911,20 +907,32 @@ static const struct i2c_algorithm nmk_i2c_algo = { .functionality = nmk_i2c_functionality }; +static struct nmk_i2c_controller u8500_i2c = { + /* + * Slave data setup time; 250ns, 100ns, and 10ns, which + * is 14, 6 and 2 respectively for a 48Mhz i2c clock. + */ + .slsu = 0xe, + .tft = 1, /* Tx FIFO threshold */ + .rft = 8, /* Rx FIFO threshold */ + .clk_freq = 400000, /* fast mode operation */ + .timeout = 200, /* Slave response timeout(ms) */ + .sm = I2C_FREQ_MODE_FAST, +}; + static atomic_t adapter_id = ATOMIC_INIT(0); static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id) { int ret = 0; - struct nmk_i2c_controller *pdata = - adev->dev.platform_data; + struct nmk_i2c_controller *pdata = adev->dev.platform_data; struct nmk_i2c_dev *dev; struct i2c_adapter *adap; - if (!pdata) { - dev_warn(&adev->dev, "no platform data\n"); - return -ENODEV; - } + if (!pdata) + /* No i2c configuration found, using the default. */ + pdata = &u8500_i2c; + dev = kzalloc(sizeof(struct nmk_i2c_dev), GFP_KERNEL); if (!dev) { dev_err(&adev->dev, "cannot allocate memory\n");