Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp499039imm; Mon, 1 Oct 2018 13:28:35 -0700 (PDT) X-Google-Smtp-Source: ACcGV62BmSdvftB+0kDTjKcEP3Ih7dbHKptE+jUECLru8sgIXNq9FfQp9fjRM2OnUXjRQCjI9+X3 X-Received: by 2002:a17:902:780d:: with SMTP id p13-v6mr13090403pll.96.1538425715889; Mon, 01 Oct 2018 13:28:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538425715; cv=none; d=google.com; s=arc-20160816; b=V/OzmFpizB6bdKXwpCKZOiezRLzaJKyjHCgMHRO2siRsELmc/UvgK6Oe5GhqTd5mcn hWqF+p3DfNfEZMTK0LACu5A9CZKe4IirxCOSeXJbjI1KcP4Zmo4FbAjTbtppptxBteJu 56Di+fTTlLGtJVDO3sDxknJLJwTCTDXPjuLM2IwyYUdEyfnW/Xbrjd3AcL6Qx9qfYPAl 8QdVyE0EYaZpvZrPZ3elluLJm4tAU+TqApApMysEUo9FiSRTPjou9Ir3VKQkhHpN3cyg urfh5vr/Ob5ojXZuB9bvk2PmUdJJzRfOgYe+7uYwHGZNUftPpdZxVx1Z+Yx4NBS++E1I 3Brg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1FMHAsvfwoeE6+66Cq+BcmDk4JOBMwj8LUlqeFF6rXw=; b=w9YD6dbTwH7ULG7EspjwuuVCWp8OfOx5Af38HKX3tmX567J9oum403Z99SwEVHRNoo BroIKQ3p4YkBStjPnZkzQWwe3WY2hC9XmMTmWqwx2Tj/Vg8zK1F5svZ8D5edFlstMwE3 qJrurQ65Hz1XZ9P9t+0VqsHbNOu3/+G/u9wDlZ6VYSzk3Jzot5k+Is5ckGD/caYBptZ0 9dKQ4lCcaLQs+Rnqt50sYgMFPd2wvpJslelC9I5fkRkTKNZYVGvhAl+SmxOmWAF02HVI Jsnhm3vDsf4M++xLN1F2V//9DD8DH7gSNej96rlI7eIERZdksIP4PVnaJGUzIdHicjcA sUJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9-v6si13115808pgl.446.2018.10.01.13.28.20; Mon, 01 Oct 2018 13:28:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726611AbeJBDHh (ORCPT + 99 others); Mon, 1 Oct 2018 23:07:37 -0400 Received: from mga05.intel.com ([192.55.52.43]:21290 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725936AbeJBDHg (ORCPT ); Mon, 1 Oct 2018 23:07:36 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Oct 2018 13:28:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,328,1534834800"; d="scan'208";a="79022368" Received: from maru.jf.intel.com ([10.54.51.77]) by orsmga006.jf.intel.com with ESMTP; 01 Oct 2018 13:27:51 -0700 From: Jae Hyun Yoo To: Brendan Higgins , Wolfram Sang , Benjamin Herrenschmidt , Joel Stanley , Rob Herring , Mark Rutland , Andrew Jeffery , linux-i2c@vger.kernel.org, openbmc@lists.ozlabs.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: Jarkko Nikula , James Feist , Vernon Mauery , Jae Hyun Yoo Subject: [PATCH i2c-next v4 2/3] i2c: aspeed: Add 'timeout' DT property reading code Date: Mon, 1 Oct 2018 13:27:47 -0700 Message-Id: <20181001202748.8030-3-jae.hyun.yoo@linux.intel.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181001202748.8030-1-jae.hyun.yoo@linux.intel.com> References: <20181001202748.8030-1-jae.hyun.yoo@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This commit adds reading code of the 'timeout' DT property to set bus timeout value in adapter configuration. This value still can be configured through an I2C_TIMEOUT ioctl on cdev too. Signed-off-by: Jae Hyun Yoo --- drivers/i2c/busses/i2c-aspeed.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c index 8dc9161ced38..6d31f54a6653 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -885,6 +885,7 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) struct clk *parent_clk; struct resource *res; int irq, ret; + u32 timeout_ms; bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); if (!bus) @@ -918,6 +919,11 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) bus->bus_frequency = 100000; } + ret = of_property_read_u32(pdev->dev.of_node, "timeout", + &timeout_ms); + if (ret) + timeout_ms = 0; /* then adap.timeout will be set by i2c-core */ + match = of_match_node(aspeed_i2c_bus_of_table, pdev->dev.of_node); if (!match) bus->get_clk_reg_val = aspeed_i2c_24xx_get_clk_reg_val; @@ -930,7 +936,7 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) init_completion(&bus->cmd_complete); bus->adap.owner = THIS_MODULE; bus->adap.retries = 0; - bus->adap.timeout = 5 * HZ; + bus->adap.timeout = timeout_ms ? msecs_to_jiffies(timeout_ms) : 0; bus->adap.algo = &aspeed_i2c_algo; bus->adap.dev.parent = &pdev->dev; bus->adap.dev.of_node = pdev->dev.of_node; -- 2.19.0