From patchwork Sat Jun 1 06:11:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagar Shrikant Kadam X-Patchwork-Id: 10971185 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE27113AD for ; Sat, 1 Jun 2019 06:11:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8F1628D34 for ; Sat, 1 Jun 2019 06:11:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A7F628D8B; Sat, 1 Jun 2019 06:11:52 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4133E28D34 for ; Sat, 1 Jun 2019 06:11:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2zjF/bfvceiGNmEWOsGCOwmFNUv/HGVKS1RMcxLFOpI=; b=BgUajoxvlvVrNc r0oiCC4VWwr5iIZXpBNPr1StI3CZAEOB4IIl2vnfDMrr1Fz4Ukqs/QRjbvyegsfCuLBopxM+upMOc D4Aq5eDNzWNA7E2sgVvbxXampz3Qs2tPpXvlK0zFEiUu/hGufmNW9NH3WSuDSQBIaMThwiL858pBM kCCu39mdbEsYa6nIMWPC08rIa0NvelvnAz+nWgwoz0XGTpJLsupZTg0W4TVPL1K2tNJMmLG4Hxm09 uQ+9VUzNmDaTHNu+LNR8COnX9+HUzyU30quXdPk57L4IzKTnS4FFpJVuII52My81cRwqeU5fh7Z6y +94+UdXfAtPvWRMJcH1w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hWxF5-000414-M0; Sat, 01 Jun 2019 06:11:47 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hWxF2-00040g-PP for linux-riscv@lists.infradead.org; Sat, 01 Jun 2019 06:11:46 +0000 Received: by mail-pf1-x442.google.com with SMTP id x10so2369640pfi.0 for ; Fri, 31 May 2019 23:11:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=VetgGylyMhr4faiTsP3IkOZ01cl3HVxVutPYPa26WFw=; b=L+8y5kH6etF8yWqZIfrxPcn7SDSUmFvtroYhlOS75cnuezAp0sSlbUpeXkKAuNm1Ou wFCPL1ZfLHMkWp1VacPzEOrPkmrtnZuF3FYhqLvcX6TKw8TzOaiyjni5+E+j3Frwv3Fu D5iWxaiY92NEkpn97ZS5iARxvYS+odyy1HAZVG6KKAZiIw1e3sXQEVu0A8ER+C9sgUBF HjkOHgX5qAZCf2P/D5Aj9sv08mG+/lpFpQdDjbY8O/1bInXAufnz56NQzzfe9H9pmt+E ++63EZjeoQg5JaASocYveM+Oy1Iqgp0HuIAziuSua6dandhnhr5Bs/gvxiC7PTh4b7lg FRuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=VetgGylyMhr4faiTsP3IkOZ01cl3HVxVutPYPa26WFw=; b=SJvpk2ogl5hA9f26yUV+vfPJj5qpOanzXGLLKm+TEd3nMpG6GaESkacGfXVSg28Tv3 XiLLX8S7K3nRA7D+OZJHkXjvPjP9gBvIq47HI9G0QKk+i9Sypz/mPbxSeVOexFLFGiJ7 4gVbIj748RbmJdQYcK7kOSBXVu0Ae9Y1xXBYmripNf+YcJvzqQVkQaRq6KA/jRL02YPN HK40UzCA7aHjQ1L3kNMe6O5a9LvsDxLDgci/g5/iw9nGRavo1dmF1syDO3qHBM6AtFgZ lo7dm3b8tIHiABBoVf0dcPXuOyQ6HTj9BV/AfnfZbtPeSHAUa7z9OVV1OiXFR5ELiwm9 aT8g== X-Gm-Message-State: APjAAAVqSOoIf9Q7tBGckVf7iyuLiGfdNlE32MhZbICQxi6vqT3oGwtM XRiYgtE4gvQE8fYJWI2SQVc8Mw== X-Google-Smtp-Source: APXvYqxI0camTekHszKzfIocQ6nPJPXPzToe6YYixiwv9Y2EBb8cNTvjszkHyNqWOoQmKBBLTOtM0A== X-Received: by 2002:a62:6585:: with SMTP id z127mr14667253pfb.179.1559369503106; Fri, 31 May 2019 23:11:43 -0700 (PDT) Received: from buildserver-90.open-silicon.com ([114.143.65.226]) by smtp.googlemail.com with ESMTPSA id 2sm8935850pgl.40.2019.05.31.23.11.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 31 May 2019 23:11:42 -0700 (PDT) From: Sagar Shrikant Kadam To: robh+dt@kernel.org, mark.rutland@arm.com, peter@korsgaard.com, andrew@lunn.ch, palmer@sifive.com, paul.walmsley@sifive.com, sagar.kadam@sifive.com, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH REPOST v8 1/3] dt-bindings: i2c: extend existing opencore bindings. Date: Sat, 1 Jun 2019 11:41:13 +0530 Message-Id: <1559369475-15374-2-git-send-email-sagar.kadam@sifive.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1559369475-15374-1-git-send-email-sagar.kadam@sifive.com> References: <1559369475-15374-1-git-send-email-sagar.kadam@sifive.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190531_231144_823858_C28FC9E0 X-CRM114-Status: GOOD ( 11.52 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Reformatted compatibility strings to one valid combination on each line. Add FU540-C000 specific device tree bindings to already available i2-ocores file. This device is available on HiFive Unleashed Rev A00 board. Move interrupt under optional property list as this can be optional. The FU540-C000 SoC from sifive, has an Opencore's I2C block reimplementation. The DT compatibility string for this IP is present in HDL and available at. https://github.com/sifive/sifive-blocks/blob/master/src/main/scala/devices/i2c/I2C.scala#L73 Signed-off-by: Sagar Shrikant Kadam Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/i2c/i2c-ocores.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/i2c/i2c-ocores.txt b/Documentation/devicetree/bindings/i2c/i2c-ocores.txt index 17bef9a..6b25a80 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-ocores.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-ocores.txt @@ -1,9 +1,13 @@ Device tree configuration for i2c-ocores Required properties: -- compatible : "opencores,i2c-ocores" or "aeroflexgaisler,i2cmst" +- compatible : "opencores,i2c-ocores" + "aeroflexgaisler,i2cmst" + "sifive,fu540-c000-i2c", "sifive,i2c0" + For Opencore based I2C IP block reimplemented in + FU540-C000 SoC. Please refer to sifive-blocks-ip-versioning.txt + for additional details. - reg : bus address start and address range size of device -- interrupts : interrupt number - clocks : handle to the controller clock; see the note below. Mutually exclusive with opencores,ip-clock-frequency - opencores,ip-clock-frequency: frequency of the controller clock in Hz; @@ -12,6 +16,7 @@ Required properties: - #size-cells : should be <0> Optional properties: +- interrupts : interrupt number. - clock-frequency : frequency of bus clock in Hz; see the note below. Defaults to 100 KHz when the property is not specified - reg-shift : device register offsets are shifted by this value From patchwork Sat Jun 1 06:11:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagar Shrikant Kadam X-Patchwork-Id: 10971187 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 090A413AD for ; Sat, 1 Jun 2019 06:11:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC1EA28D34 for ; Sat, 1 Jun 2019 06:11:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E076A28D8B; Sat, 1 Jun 2019 06:11:57 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 92C8E28D34 for ; Sat, 1 Jun 2019 06:11:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kqdYJduMH/h9l0QXwEnsXZtYSk2xRNnTZuQXaJRe/bQ=; b=ArE51ESWoUkicY E3L9cd+p8Bhg0Vc0XjVPVljW3Che11ROphrKHY+wHBaK+rKxWlEXc0+ZjX/OzTd3/+6+hBw6mztKt mNzfTbVHTfOEj8g49tVCnEg8AHevbDaXKSDqWQjoy2Z+RJa36cfRznvlxdaz2YasN5kR9EldnJfPZ p8Ah3Rh7bg/+zJPlvNK1vxx4SWxcXEzwUbzWSpE3PG9g+hedYks4AQiDMXEdGRlVE9UMYAmMmJnuq SG8PUwdp3fqwY9xd/nE9iRwGX9mIk8I+zLrPQkfw0Zr1tj49x9/pgrLSMNfkphJI8NjymMlwSqC3z y3F+FDeNrjA32FuoCTkA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hWxFA-00044E-BV; Sat, 01 Jun 2019 06:11:52 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hWxF7-00043A-Km for linux-riscv@lists.infradead.org; Sat, 01 Jun 2019 06:11:50 +0000 Received: by mail-pf1-x442.google.com with SMTP id c6so7476066pfa.10 for ; Fri, 31 May 2019 23:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=/BRFvwHTJGi4mC+l6/NtyYz/ZOf9cjorYo3iOt6cwfc=; b=GYWLNCJxwtsJELEDc5nOhmMnFhrKwQdhBjRn/pKyrJmzcf6pahtsoYHDBq+A92qt9z CKOroINqBp1vkIndKgWR+oEcf11Suw39Yg7+jtLk5PE8a/8iwxexLe8YnsyRFbt/M0Aw U+guAgtPl5u2eJRJhqlKsoxPrYUHxVJNYNxkmTnO6etOVMsMXG7M6kK8xfbHPLMjllgP nvCPJBqQQvRf+Q9Ynwl7ENeH6EUxw98uPQSFkCO8TY/kSEKBFOfslVh+dMcAxHDblCDi PBhpoERxK22Q4q6VPYMNgQgguFBIG6CDZ5JQtZ6O+QpI5/hQ3Ru0lkdIwgSsMN4MOPps UiOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=/BRFvwHTJGi4mC+l6/NtyYz/ZOf9cjorYo3iOt6cwfc=; b=HRljHLHgIny/BeBaGeikHvoOZ4synkM4WsRR0gWo5WFw+tlkdAskMQcqFIFTSL2kqZ i7lZhhH5MQlPSfBfzc99LM/ICE0hvOD7ZMI/seS0WaPvRFZ9Qv63cJtrmYg2DRcCbskg yFxNbEajZHD5l64ibc9caf5cod0MARVepAicU0nTspD6V5ywZgyiFdcVPloil48Utep4 Tr9ogzAsvYi8Ek9vo8gQr3KTSd39oys/580vfrAAi3es3aOlhMJ5PkJvIcxP0PG9rypE SB1/Yd3drWPa9Xb9zO7fzqNp5qUZMXVq40kJW6/WMoNukaV4OO+/f769Ok7HShADPFLb FfAg== X-Gm-Message-State: APjAAAVWpH2oe5b2zOYJvKgYbNZxD19b+qk88Ot/92iJmg5ReprYNfK3 vQ3rEDqRVwLVe7YVTX1pTa67AA== X-Google-Smtp-Source: APXvYqzlk3hrluDCHk21oBfq1TiS/zO95WiT9eRFQoVOSTZcNwULqaajTm6A9o7fAd6f12vsWlBp5w== X-Received: by 2002:a63:8449:: with SMTP id k70mr13784046pgd.208.1559369509095; Fri, 31 May 2019 23:11:49 -0700 (PDT) Received: from buildserver-90.open-silicon.com ([114.143.65.226]) by smtp.googlemail.com with ESMTPSA id 2sm8935850pgl.40.2019.05.31.23.11.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 31 May 2019 23:11:48 -0700 (PDT) From: Sagar Shrikant Kadam To: robh+dt@kernel.org, mark.rutland@arm.com, peter@korsgaard.com, andrew@lunn.ch, palmer@sifive.com, paul.walmsley@sifive.com, sagar.kadam@sifive.com, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH REPOST v8 2/3] i2c-ocores: sifive: add support for i2c device on FU540-c000 SoC. Date: Sat, 1 Jun 2019 11:41:14 +0530 Message-Id: <1559369475-15374-3-git-send-email-sagar.kadam@sifive.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1559369475-15374-1-git-send-email-sagar.kadam@sifive.com> References: <1559369475-15374-1-git-send-email-sagar.kadam@sifive.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190531_231149_677242_93B019FA X-CRM114-Status: UNSURE ( 9.47 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Update device id table for Opencore's I2C master based re-implementation used in FU540-c000 chipset on HiFive Unleashed platform. Device ID's include Sifive, soc-specific device for chip specific tweaks and sifive IP block specific device for generic programming model. Signed-off-by: Sagar Shrikant Kadam --- drivers/i2c/busses/i2c-ocores.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c index c3dabee..b334fa2 100644 --- a/drivers/i2c/busses/i2c-ocores.c +++ b/drivers/i2c/busses/i2c-ocores.c @@ -82,6 +82,7 @@ struct ocores_i2c { #define TYPE_OCORES 0 #define TYPE_GRLIB 1 +#define TYPE_SIFIVE_REV0 2 static void oc_setreg_8(struct ocores_i2c *i2c, int reg, u8 value) { @@ -462,6 +463,14 @@ static u32 ocores_func(struct i2c_adapter *adap) .compatible = "aeroflexgaisler,i2cmst", .data = (void *)TYPE_GRLIB, }, + { + .compatible = "sifive,fu540-c000-i2c", + .data = (void *)TYPE_SIFIVE_REV0, + }, + { + .compatible = "sifive,i2c0", + .data = (void *)TYPE_SIFIVE_REV0, + }, {}, }; MODULE_DEVICE_TABLE(of, ocores_i2c_match); From patchwork Sat Jun 1 06:11:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagar Shrikant Kadam X-Patchwork-Id: 10971189 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 336476C5 for ; Sat, 1 Jun 2019 06:12:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2295828D34 for ; Sat, 1 Jun 2019 06:12:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1700528D8B; Sat, 1 Jun 2019 06:12:02 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5C3CB28D34 for ; Sat, 1 Jun 2019 06:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=haDMJV087DKTVS1FcjlLr7TtSrCuoWHqRDpZXy5+368=; b=IpEY9jMXrNLDwD zYjXrxcziihxTpQqInQG1zL1wVsi53i2SYNCY6qOKvJ59ZxiX+MRkb+5vA//1hycrWLYQGh8p2oX0 SET7I9zamx9HHXbWvbg0zqC17k/Z0wWQRbAuY+CQbAsv17QzS+OwecaPPUMPk4MCh9GIcPeJgEwDc ii/O+QIZdVsXLUZRMjHzXM0nQVZ+DbuntFrFqve5zFvD0XF+IQ5DYsZJj/OQAnJUHirwG+VxSBYdu yE7PerFAQ0Aog3y4RFD+hd9Vx/weN0J6Lo/zoiOIReIWy2iKH4b8ltUrswRRezC3VH/vQr3WMEzXz tGtwGHDihnk/i2pCb0Ow==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hWxFG-00048R-0V; Sat, 01 Jun 2019 06:11:58 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hWxFD-000472-Gw for linux-riscv@lists.infradead.org; Sat, 01 Jun 2019 06:11:56 +0000 Received: by mail-pf1-x444.google.com with SMTP id c14so5079215pfi.1 for ; Fri, 31 May 2019 23:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=SOLuY/R/QS+l1W9FKWqgele10Viv9LvbKIwVAA0kNm8=; b=d+cvo2gIFq6hLOlcwYDfGirRUjDXJLuj5z61HgVDs72gYfgBpvUrHrxic6IdRyYNK6 64sdFMaYgyrIM2I+55keFM26XVesvzBEkNS4lRyfEazbFN5tmkBNX4Sn+iAUsB/jlxou IbVPwJUO6aw4M9lkQj+5SJhH1n9mi86mK/afg8kY9OWezCV/Yqjxh8h1QKiDAoOJdwgP iiLDalPwwEIFUx3jdSrigiQSZuccIHWEe8o2hPC6WAd3m13lOpnUjCBMvuJPQr3nYARI Dv225GD/CMEyRl+ZchLqkU2PrF0q38vB7knwerfSNZEfPVmSk/R+Q6RBiMnEE0IEVIOY 2pXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=SOLuY/R/QS+l1W9FKWqgele10Viv9LvbKIwVAA0kNm8=; b=bXsNOkOjKziPYY60q+s9JZLvT+mo13nKzkzEV/IaULC1aPMnt5X1b+XmdK80SzYpXM d2MUu1AQFrfMzJaP6l3gmXhQoCa7H3+kWRR16UuSG21a9PxgasRd/IL/6sxoAcI0ZSo4 0yKOTo1Z8qS60t0w9RBsLNFJYRTHUoENVOdwPFU4PY1liVHRZZP0vRjykQ2IQ0A3ZJZx jVkrQN24HKMUnV6sZSkhKnInDeVi7DJQZ1Ltw083t+FtilYEDMVz5nxMD3H/LacfyY87 gh0ZTxcfiFITPUJHsDBDGdOnpTTxcmPOJUbtvG79LwfVvEq8Pi4QEemXrOby99Qr9nDM z21w== X-Gm-Message-State: APjAAAUDmLOoZTu/9FtzVg3KsTo5eROZhshDuN7mlb4wuCdAibdqwcfT HGeYd3ugAh2DyBEPbHaoAtbGmQ== X-Google-Smtp-Source: APXvYqyaFP3RwpKW0rt3bz1dzY/B4BEYi8u/4Gpw4jzlPR9FDwU98CbU1B23zpMqMoCntWhYDmyfag== X-Received: by 2002:a62:5f02:: with SMTP id t2mr15171599pfb.7.1559369514886; Fri, 31 May 2019 23:11:54 -0700 (PDT) Received: from buildserver-90.open-silicon.com ([114.143.65.226]) by smtp.googlemail.com with ESMTPSA id 2sm8935850pgl.40.2019.05.31.23.11.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 31 May 2019 23:11:54 -0700 (PDT) From: Sagar Shrikant Kadam To: robh+dt@kernel.org, mark.rutland@arm.com, peter@korsgaard.com, andrew@lunn.ch, palmer@sifive.com, paul.walmsley@sifive.com, sagar.kadam@sifive.com, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH REPOST v8 3/3] i2c-ocores: sifive: add polling mode workaround for FU540-C000 SoC. Date: Sat, 1 Jun 2019 11:41:15 +0530 Message-Id: <1559369475-15374-4-git-send-email-sagar.kadam@sifive.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1559369475-15374-1-git-send-email-sagar.kadam@sifive.com> References: <1559369475-15374-1-git-send-email-sagar.kadam@sifive.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190531_231155_587278_E1ABF39E X-CRM114-Status: GOOD ( 15.40 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The i2c-ocore driver already has a polling mode interface.But it needs a workaround for FU540 Chipset on HiFive unleashed board (RevA00). There is an erratum in FU540 chip that prevents interrupt driven i2c transfers from working, and also the I2C controller's interrupt bit cannot be cleared if set, due to this the existing i2c polling mode interface added in mainline earlier doesn't work, and CPU stall's infinitely, when-ever i2c transfer is initiated. Ref: commit dd7dbf0eb090 ("i2c: ocores: refactor setup for polling") The workaround / fix under OCORES_FLAG_BROKEN_IRQ is particularly for FU540-COOO SoC. The polling function identifies a SiFive device based on the device node and enables the workaround. Signed-off-by: Sagar Shrikant Kadam Reviewed-by: Andrew Lunn --- drivers/i2c/busses/i2c-ocores.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c index b334fa2..4117f1a 100644 --- a/drivers/i2c/busses/i2c-ocores.c +++ b/drivers/i2c/busses/i2c-ocores.c @@ -35,6 +35,7 @@ struct ocores_i2c { int iobase; u32 reg_shift; u32 reg_io_width; + unsigned long flags; wait_queue_head_t wait; struct i2c_adapter adap; struct i2c_msg *msg; @@ -84,6 +85,8 @@ struct ocores_i2c { #define TYPE_GRLIB 1 #define TYPE_SIFIVE_REV0 2 +#define OCORES_FLAG_BROKEN_IRQ BIT(1) /* Broken IRQ for FU540-C000 SoC */ + static void oc_setreg_8(struct ocores_i2c *i2c, int reg, u8 value) { iowrite8(value, i2c->base + (reg << i2c->reg_shift)); @@ -236,9 +239,12 @@ static irqreturn_t ocores_isr(int irq, void *dev_id) struct ocores_i2c *i2c = dev_id; u8 stat = oc_getreg(i2c, OCI2C_STATUS); - if (!(stat & OCI2C_STAT_IF)) + if (i2c->flags & OCORES_FLAG_BROKEN_IRQ) { + if ((stat & OCI2C_STAT_IF) && !(stat & OCI2C_STAT_BUSY)) + return IRQ_NONE; + } else if (!(stat & OCI2C_STAT_IF)) { return IRQ_NONE; - + } ocores_process(i2c, stat); return IRQ_HANDLED; @@ -353,6 +359,11 @@ static void ocores_process_polling(struct ocores_i2c *i2c) ret = ocores_isr(-1, i2c); if (ret == IRQ_NONE) break; /* all messages have been transferred */ + else { + if (i2c->flags & OCORES_FLAG_BROKEN_IRQ) + if (i2c->state == STATE_DONE) + break; + } } } @@ -595,6 +606,7 @@ static int ocores_i2c_probe(struct platform_device *pdev) { struct ocores_i2c *i2c; struct ocores_i2c_platform_data *pdata; + const struct of_device_id *match; struct resource *res; int irq; int ret; @@ -677,6 +689,14 @@ static int ocores_i2c_probe(struct platform_device *pdev) irq = platform_get_irq(pdev, 0); if (irq == -ENXIO) { ocores_algorithm.master_xfer = ocores_xfer_polling; + + /* + * Set in OCORES_FLAG_BROKEN_IRQ to enable workaround for + * FU540-C000 SoC in polling mode. + */ + match = of_match_node(ocores_i2c_match, pdev->dev.of_node); + if (match && (long)match->data == TYPE_SIFIVE_REV0) + i2c->flags |= OCORES_FLAG_BROKEN_IRQ; } else { if (irq < 0) return irq;