From patchwork Tue Nov 22 04:41:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 9440497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 51B13605EE for ; Tue, 22 Nov 2016 04:44:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44E4F28179 for ; Tue, 22 Nov 2016 04:44:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 353F5281F9; Tue, 22 Nov 2016 04:44:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B933228179 for ; Tue, 22 Nov 2016 04:44:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c92v0-0002AD-2u; Tue, 22 Nov 2016 04:42:54 +0000 Received: from mail-pg0-x232.google.com ([2607:f8b0:400e:c05::232]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c92uv-00029h-Av for linux-arm-kernel@lists.infradead.org; Tue, 22 Nov 2016 04:42:50 +0000 Received: by mail-pg0-x232.google.com with SMTP id p66so3185825pga.2 for ; Mon, 21 Nov 2016 20:42:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=QIMU6CPmDstUUfFXW9SxkAMZ3qKyNumogencXlOgh1M=; b=coW1/8AkxQ5KgoJCbF0JIJ2g50mi5SIj1fRwolS/t5JsiZmeCkrX5ixtw+ql9MUE/2 Bkte/VmLvIXSXvkKZL/PUaVlZzOXScT7P85q+7O8Z5E5osI7Vwz6vbIfmFbIntkOxQfe 6Cr02iAt4yNCUfl7G1rM6KD5qCbdv3c9YyX2M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=QIMU6CPmDstUUfFXW9SxkAMZ3qKyNumogencXlOgh1M=; b=G1sTJvQSM8SGfpRRqt1ccpaCEprj6E/0Y2QhN8Enjfs94H0nABG7AsKNUIv3L1P9Ei GZgOmbKC05adVQ8xl/um4I2n9eLb64YAHawATQoe6t6/wh3WyBj60ZmlNzggMFyjctSp hmcG/9mhPXuuM6t5d6UeCJu1ltAzJDwgF3aLdEQHPah0JwqBkxzTffCD0kFYegvPqurn nS2fEBd+12tgRZC587vhaOiIYbjtripBQkVAdueyCo1/tnL62TcmWx82Pv1RpJFyTEe3 HLPeIcwYr7Io+XgMLCtbbYTfoMiFRx1iZra6UBzkR8KPg8tDGIDEyr+LKLXf84Lhhd02 0g1A== X-Gm-Message-State: AKaTC00KFNqEFjdnCXe9S+MX+/L0Pz9mae/vNxQzVINgWRQUEAYDNcWcw+4pfIdlSrNmBUAD X-Received: by 10.99.101.65 with SMTP id z62mr39991720pgb.74.1479789744883; Mon, 21 Nov 2016 20:42:24 -0800 (PST) Received: from localhost.localdomain ([104.237.91.87]) by smtp.gmail.com with ESMTPSA id s2sm41000141pfi.10.2016.11.21.20.42.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Nov 2016 20:42:24 -0800 (PST) From: Zhangfei Gao To: Wolfram Sang Subject: [PATCH] i2c: designware: add reset interface Date: Tue, 22 Nov 2016 12:41:40 +0800 Message-Id: <1479789700-19532-1-git-send-email-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161121_204249_466425_2AC7167D X-CRM114-Status: GOOD ( 12.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhangfei Gao , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some platforms like hi3660 need do reset first to allow accessing registers Signed-off-by: Zhangfei Gao --- drivers/i2c/busses/i2c-designware-core.h | 1 + drivers/i2c/busses/i2c-designware-platdrv.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h index 0d44d2a..94b14fa 100644 --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h @@ -80,6 +80,7 @@ struct dw_i2c_dev { void __iomem *base; struct completion cmd_complete; struct clk *clk; + struct reset_control *rst; u32 (*get_clk_rate_khz) (struct dw_i2c_dev *dev); struct dw_pci_controller *controller; int cmd_err; diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 0b42a12..fd80e58 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -176,6 +177,10 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) dev->irq = irq; platform_set_drvdata(pdev, dev); + dev->rst = devm_reset_control_get(&pdev->dev, NULL); + if (!IS_ERR(dev->rst)) + reset_control_reset(dev->rst); + /* fast mode by default because of legacy reasons */ dev->clk_freq = 400000;