From patchwork Mon Aug 6 12:25:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 1278751 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 37A86DF215 for ; Mon, 6 Aug 2012 12:28:48 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SyMNp-0002cQ-Tv; Mon, 06 Aug 2012 12:26:06 +0000 Received: from mail-wi0-f171.google.com ([209.85.212.171]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SyMNk-0002YQ-SX for linux-arm-kernel@lists.infradead.org; Mon, 06 Aug 2012 12:26:01 +0000 Received: by wibhq4 with SMTP id hq4so1259465wib.0 for ; Mon, 06 Aug 2012 05:25:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=r/MVVMScsv+9a4TRtbvh0/am84JYSrHJjW3S3100jUQ=; b=oNv5hsTUn++zOGw57qc26kFmQCohkARiokl6QvNLBDh9uNViQbP52BkSZJeXrC9HIE uBfifUONr5UyZ6dBEplHj4uMV5YJ79zTf2BD2t9l8gIcFaWUyd0knjqTFMyw33uLj0yG w0vevPZbbP19q8wz9w1a19nExEslklHeEbdRwKY6R5qtTnPe6pV1zMjnL3pvcXizx6p0 c1CtTCfLBL3ampUJVJMdxepiXYl+5Qd8mbjdoQnX28l0fz5eMI72XrHhU5bdrw7cnzYl jzwDD4UPJAffKZA9jcTrtBum42mN4ATBC223FHEj3mkpoXD8NtetlggDUjtql9CxGIhe V5TQ== Received: by 10.216.123.69 with SMTP id u47mr5619963weh.89.1344255957014; Mon, 06 Aug 2012 05:25:57 -0700 (PDT) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id l5sm22617728wix.5.2012.08.06.05.25.55 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 06 Aug 2012 05:25:56 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver. Date: Mon, 6 Aug 2012 13:25:47 +0100 Message-Id: <1344255947-10062-1-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQkw3gysuJYXi7DmwZ1bt5bsI+dfMPrOnt6xd0vwIE0yNRhDcZ6IowIDQ++6eUdNzmqIchuP 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.212.171 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linus.walleij@stericsson.com, arnd@arndb.de, srinidhi.kasagar@stericsson.com, w.sang@pengutronix.de, linux-i2c@vger.kernel.org, STEricsson_nomadik_linux@list.st.com, Lee Jones 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: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index a92440d..34ab587 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -333,10 +333,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 @@ -899,15 +895,31 @@ 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 int __devinit nmk_i2c_probe(struct platform_device *pdev) { int ret = 0; struct resource *res; - struct nmk_i2c_controller *pdata = - pdev->dev.platform_data; + struct nmk_i2c_controller *pdata = pdev->dev.platform_data; struct nmk_i2c_dev *dev; struct i2c_adapter *adap; + 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(&pdev->dev, "cannot allocate memory\n");