From patchwork Wed Oct 21 14:50:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagar Shrikant Kadam X-Patchwork-Id: 11849255 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 943861744 for ; Wed, 21 Oct 2020 14:50:46 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 328912224E for ; Wed, 21 Oct 2020 14:50:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WxqVrNJV"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sifive.com header.i=@sifive.com header.b="szuO0gzB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 328912224E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=OqGkYbM/qKQeWsoc6/71cTss9XczC5RGGfHVzN5axyk=; b=WxqVrNJVdu/WgzU846E4yMBMX2 OxmRHZLeMKhH1ystsPXEHi73qoyhoP252GIVLMjX6fyCO251quu711dUrRa7xBrzi7VVmfXD8V5Rp cr3whOBXxJLNH29h4u1MUll7K5TFXBUHJEAzXKEpMgdGPJLrtX01IGQYd+jVmE+GGY7UUdUlojIJd XkSizIAVyaDoGCo1aCKnx/y6v5/k4azaohXRs2vAWuDj2QcSDErJaCP1ZmGv9t7tGHDFbUOaqhm1d 5ezdO7Ipe7lEeGpiHDZ8w4/Xia/KUgw3isTzn503sWF0ezeeZfPPlnd2iDbpTNQkTGGUfsYAXm+L+ hm1DgSSw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVFRd-0000HJ-AP; Wed, 21 Oct 2020 14:50:29 +0000 Received: from mail-mw2nam12on2058.outbound.protection.outlook.com ([40.107.244.58] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVFRa-0000Fj-Bc for linux-riscv@lists.infradead.org; Wed, 21 Oct 2020 14:50:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZNiDDmsR7GRngiobHAJZqiUqMUtOpeJMFPiZTPyUxKuzftZZ2vYqv75f4UTc9F4AtVe6J937oZG3gZ8HvpH9baTtqmKxaQ8PLeydbVu2PWCfOt3jO5R4Z4yqV74SlI5fzQ4utC69FuGFyP5UJgDG7ghf3LnenCuOKOp1hvDhkbOPUy97fc5MVR92D7MsbNFeMpC0QevUplS+jyqp3jT+q+5f5ppgfsgKVwxJbP/vMIYWQPbMzWxphaQstRrgrU9wqCYr9gAyYk3G8R41N0NthW/Dpnr6oJBAE1D3+gCQ8bMkhyqTi1tEbmbrUl6llDUA87sV9LsX7zkY38+SxDEVnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vQqLobpJOK/5ns45dlctVmoMFqvzYQKkW0sko/oTScM=; b=jHaM8GQhJh2m65LnfBU0LhVn/h6kE9mPVIFCuheRAiSVr3DLea7ZVJxmoX9yLBQdHSIQLKNiZSmcPNPhYy++CF35aUT+k+EwECkkGiqP7ygsiXYFjVt/EUubadg7PDhtGaSPMpgNyFpG7sU5moxMHyXV8kY+M9tndyCt7zaaktyk+9nr7TV2NEufm7an12k6ZaIqUIUQzr186fjbP8XGVRDe8NBNoDpiMVZCkeYFh6M/9a086ipj+TOzWMIcCVdPEnMG0LtGDwSV4KcmOcM0SrNVRxgYde/vqOzYWvfKjPqvxjcHZ4K7v4YyWRrAc78Li4B5EvEjN2cZF6olfnKW6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=openfive.com; dmarc=pass action=none header.from=sifive.com; dkim=pass header.d=sifive.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vQqLobpJOK/5ns45dlctVmoMFqvzYQKkW0sko/oTScM=; b=szuO0gzBW4oKHn1fxn3MwfvEOb8zBkPXbYhjeFS804nAWJBs555kCt0ko/qPJ8Vc1v9QdUjFi8w8Idsm2JGHiAZ9RM/+c7oNpGZkjLxZT/oKLpHAe+ei0/Zg8rkUhbrSuR48XUxjLvRJ7hbL8aPpkTmTyZSOvv89nhwvuHfS900= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=sifive.com; Received: from DM6PR13MB3451.namprd13.prod.outlook.com (2603:10b6:5:1c3::10) by DM5PR13MB1244.namprd13.prod.outlook.com (2603:10b6:3:2e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.8; Wed, 21 Oct 2020 14:50:23 +0000 Received: from DM6PR13MB3451.namprd13.prod.outlook.com ([fe80::f49f:d6d6:4c97:e5d5]) by DM6PR13MB3451.namprd13.prod.outlook.com ([fe80::f49f:d6d6:4c97:e5d5%7]) with mapi id 15.20.3499.017; Wed, 21 Oct 2020 14:50:23 +0000 From: Sagar Shrikant Kadam To: linux-kernel@vger.kernel.org Subject: [PATCH v4 0/1] fix i2c polling mode workaround for FU540-C000 SoC Date: Wed, 21 Oct 2020 07:50:13 -0700 Message-Id: <1603291814-240377-1-git-send-email-sagar.kadam@sifive.com> X-Mailer: git-send-email 2.7.4 X-Originating-IP: [64.62.193.194] X-ClientProxiedBy: BYAPR21CA0008.namprd21.prod.outlook.com (2603:10b6:a03:114::18) To DM6PR13MB3451.namprd13.prod.outlook.com (2603:10b6:5:1c3::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from gamma15.internal.sifive.com (64.62.193.194) by BYAPR21CA0008.namprd21.prod.outlook.com (2603:10b6:a03:114::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3499.17 via Frontend Transport; Wed, 21 Oct 2020 14:50:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 760c16af-47b5-4293-7ae9-08d875d0a360 X-MS-TrafficTypeDiagnostic: DM5PR13MB1244: X-LD-Processed: 22f88e9d-ae0d-4ed9-b984-cdc9be1529f1,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HlVd70NhX/vYxWHc4Tbv88cnpZv1B6xdhU9d2taKanqMnaUyL1ZP5A5f1745+XwmebOOs0vU2D6JgUXRTuuTz1Vk1DVWCLATumzEoQcGUeZ0ERQE1Uuqu1Jy12wMZNnIAu+T5W/UaQTMzbG5mpG1dO7ImJkgrv43Uxs14968j+kGg7ni3kmS5SfSkdVBwi6LlboZyAxwDqcPbdr3rr4l4PDsVaIMS+lXLFZDZ8IMc3tPKjfk2ozAbt+6SDI9Li28jqJZd6jPgGalbNI3XDDTQakMXGp/Cr3xe/+9artuF0S72mPhCaZgEWQytugR0bKJ7SoCLlWTi1z3K+XcYsraBedR661wc/P8unZRlUBfkDVdsbnQ4jg+GkhVdJQoQ6/VwURScoxK2++qcBeTCKIgZw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR13MB3451.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(366004)(39840400004)(136003)(396003)(346002)(83170400001)(66556008)(66476007)(5660300002)(66946007)(83380400001)(6916009)(4326008)(186003)(16526019)(107886003)(6666004)(26005)(8676002)(966005)(36756003)(478600001)(52116002)(6486002)(2616005)(7696005)(316002)(8936002)(956004)(42882007)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: e0z8BAP0XJqFZ7yYrQVqjAgqpcGKQpF90Cu91KSHEpbp6GPunBr0GefuohYMh8sdy/USwLnK5LkcbQOmtCR86Z3t8XK2JJFkVScLGrvSC6hDvBRVY8vp2+eNTMhruulAj4CpW+hjwKuOADv17DxZ+hOFDetrfGc7OrxdiS4OJkybODV+41Nb/kvufxjTtL03O0T6MzK6C0BEHGoWwLH3YnhixmeN5BF2z33n7MgiuNc6Zi5UKvkScBIUCjb+NXKGWxV8LcH3wJiURuWrEiYbXcIwhciwE4KurPESu3MjpTr+9Ua9qGuSo2fvZgOhqL7W16cH+2v0YKgfvB7IxgbFyFXX/Pgfdvt+XojaYvLabqpZmdmMkfqpgdPGNbGxC49GDgZE4zOF9UZlX/wRwq/bNIk2TqY0TuDG04RHIXTJBqG568Aa/N2BAfA6Nnn142rGDwMT6yZijkg13BYcO/CdjmUDwxt5yEx2+mUt7pFw+cKn3POf2iHZNMoe8HT6iGI0QPfjChPH6Y/tZOOUEC8USsfk5FwIoriasCgSO1g+Zg5W+aq3liVBp4XN2gBVMKZlNWdfffJyO0H+gYQhRlM9I/3N7PBJDWQmaRU+sOUIsh+qAZUPWLLjrin+a/Guk2Jr/QTDlLerx4KI7o2txjfaVg== X-OriginatorOrg: sifive.com X-MS-Exchange-CrossTenant-Network-Message-Id: 760c16af-47b5-4293-7ae9-08d875d0a360 X-MS-Exchange-CrossTenant-AuthSource: DM6PR13MB3451.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2020 14:50:23.0160 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 22f88e9d-ae0d-4ed9-b984-cdc9be1529f1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bPYxbLYAaltdsq29MNqxIwfa6ClVQ9QJBubhtjLSIFQrTvO4WSNPRh/4uj0cUZ3T3KM40PcDb6cm3uFbWS/sJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR13MB1244 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201021_105026_552653_816E7D5B X-CRM114-Status: GOOD ( 12.31 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [40.107.244.58 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.244.58 listed in wl.mailspike.net] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@lunn.ch, peter@korsgaard.com, aou@eecs.berkeley.edu, palmer@dabbelt.com, linux-i2c@vger.kernel.org, paul.walmsley@sifive.com, linux-riscv@lists.infradead.org, Sagar Shrikant Kadam Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org The polling mode workaround for the FU540-C000 on HiFive Unleashed A00 board was added earlier. The logic for this seems to work only in case the interrupt property was missing/not added into the i2c0 device node. Here we address this issue by identifying the SOC based on compatibility string and set the master xfer's to polling mode if it's the FU540-C000 SoC. The fix has been tested on mainline Linux 5.9 with a PMOD based RTCC sensor connected to I2C pins J1 header of the board. Log for reference # uname -a Linux buildroot 5.9.0-00001-ge092bd7 #1 SMP Wed Oct 21 06:19:31 PDT 2020 riscv64 GNU/Linux # i2cdetect -y 0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 6f 70: -- -- -- -- -- -- -- -- # i2cget 0 0x57 0 b -y 0xf9 # i2cset 0 0x57 0 0xa5 b -y # i2cget 0 0x57 0 b -y 0xa5 # i2cget 0 0x57 1 b -y 0xa9 # i2cset 0 0x57 1 0x9a b -y # i2cget 0 0x57 1 b -y 0x9a # i2cget 0 0x6f 0x20 b -y 0x98 # i2cset 0 0x6f 0x20 0x5a b -y # i2cget 0 0x6f 0x20 b -y 0x5a # i2cget 0 0x6f 0x5f b -y 0x55 # i2cset 0 0x6f 0x5f 0xa5 b -y # i2cget 0 0x6f 0x5f b -y 0xa5 # Without the fix here, it's observed that "i2cdetect -y 0" turns the system unresponsive, with CPU stall messages. Patch History: =============================== V4: -Used alternate implementation as suggested here: https://lkml.org/lkml/2020/10/15/513 -Removed TYPE_SIFIVE_REV0 field as it is no longer needed to set the polling mode and OCORES_FLAG_BROKEN_IRQ flag. V3: -Rectified typo as suggested here: https://lkml.org/lkml/2020/10/9/902 V2: -Incorporated changes as suggested by Peter Kosgaard https://lkml.org/lkml/2020/10/8/663 V1: Base version Sagar Shrikant Kadam (1): i2c: ocores: fix polling mode workaround on FU540-C000 SoC drivers/i2c/busses/i2c-ocores.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)