From patchwork Wed May 19 07:49:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 12266575 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D32F9C433ED for ; Wed, 19 May 2021 07:52:16 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 5B40361244 for ; Wed, 19 May 2021 07:52:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5B40361244 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=os.amperecomputing.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=S0Gyasq2tqIMvDETpttosj7pW46lpQWXGho0vUVe+u0=; b=mSquBKiMLFxCFPnIJ8X1vhHcC JvvtRHf1xYAittrgmjaLqJIezwhXVNOyZEq7OKyV+oa4fUhRZnwcApcuLalB97maX2mWq3ftghI3L dGzauw7O9mSMiIyeonIm8iktcnxGAt8IFMYZvaY7QkzZZOuFTrMoUOB3Em5H7f9z7ubdaOWiu5G2p ypgqbJYZ06+PWpB8fnwu66na5hAmi2Jy0qMiXqUsuu3itqgZugmRHF8jDGDNODu9eTFyEXfT1bz5v L3VblHsTbB5MP1u6g9MvBVMWqXUb6EeUtrtyeIC9NPQeQMfUI/Ns82e3xEhWWcxWHWUdlSdYcp2CW 2UCn29nXQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyY-003EJV-Tq; Wed, 19 May 2021 07:50:43 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyK-003EFX-Ul for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 07:50:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=ZPvJYCQ34HkZHonaIejkvrkgzZ75z1OPkw/fSHEanIc=; b=WNSxRbTgbFFGy8foiWPFXqKWqV Y2dtn4oMVJKKPWsK0MRyKpummRvqWyTv1uxUw5TrWfeeh0gfwwSFdIH+q0Hr47B+4UeKSFlxj5kuo DLlh5pgJFDy4WnJ1rPBg66efkFxwl6KMRmQKy5R1BNbgKQJWfGUubILlTXsjWTrlR81RaYTkmFhoj 8DyudK+7cq3XfIKNZC2dRdpTHMX+y9vap7pSUS2KDZB/4PMUIB/ZLxxHaVFqV/JENJY3oCvypwewg U9wF5RJDgDg4YZKnud0my2kzEjiFcsP2/42U5bfxpOUYsthNGgxajbIW8zpuXUaN52FmOR5m50ZQa GfCn/Q1g==; Received: from mail-dm6nam10on2124.outbound.protection.outlook.com ([40.107.93.124] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyI-00FEbU-EY for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 07:50:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d0J8gUImQqdj84aKv32CUgxa0dRV6Mrzd/s1hOlxERbRrIlnUAxMidYcP5KUyW4S+/xJWPs+1sd4J5ckcfz5c7/aOX8pgU9dWvz8tLqtnORRhmozXCCnu9qg8OGMNUjHjrUfzjFfA7c0KYfL3om2tTGWXXg3ui4WO/eO8hJozH3BGfIgpnlsZjKTp3Cz77yzcbWrg3b3TuaXWqFmiH0jpnDzl0K119A584aMwuja4cWGFgzwe1xT/2yHq0ITYtHWEuPr2RhojRYkDIwQ1Dofc6YYXjixW73d5rAliWTnI135rOx4JleF00BLT/M9oASnP57wrE698aXfViXu7xiVOw== 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=ZPvJYCQ34HkZHonaIejkvrkgzZ75z1OPkw/fSHEanIc=; b=duxFUUF2Yi8KpoNRCItpj/c548s+jnmOvXzgNHbU8FnnA9TWTiyRoBd3BFWbpnYOU33X0NR1BQrS7hA8yeClmzhTqHIVUCC4MNPBT4yN+NV5TyhIWC9qbBybRaSzLBM90ZVldkzUZg6c7E93O0jZC0zCmLEduAyEVac+WAjF6J4zpuYnqeeMdij/HkY9s2RPLkjPJ4/iEINnHPC0mw0H0LbuKRZl0vBFkbThPMmEbFowkpoAdWry4YM4IR/aGpgT0H+dagqJcTYRah48Og8+9t1h5HpGsM7ptkrjdFnPQIGz+Jg9di1csHcAMqd7gdwaoaSxmHsbstUao6uMT2okwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZPvJYCQ34HkZHonaIejkvrkgzZ75z1OPkw/fSHEanIc=; b=qUGj5Hg0p8/tKW5K5HSOrk4Of0W9wYsQk2c3v700OiUNspcqv9L+7w4Gse8B+rNVbCYcU7Pta5AiVjNO/upwK91mmEXxmC5YsuqUqS8KmurjzAi/XjmI2k9BHWZ801rCsi+EAD7cAJ/T0kq0buXiVtN4dz4sSB/tBfYbze17kEQ= Authentication-Results: acm.org; dkim=none (message not signed) header.d=none;acm.org; dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) by MW2PR0102MB3451.prod.exchangelabs.com (2603:10b6:302:10::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.28; Wed, 19 May 2021 07:50:21 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503%5]) with mapi id 15.20.4129.032; Wed, 19 May 2021 07:50:20 +0000 From: Quan Nguyen To: Corey Minyard , Rob Herring , Joel Stanley , Andrew Jeffery , Brendan Higgins , Benjamin Herrenschmidt , Wolfram Sang , Philipp Zabel , openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org Cc: Open Source Submission , Phong Vo , "Thang Q . Nguyen" , openbmc@lists.ozlabs.org Subject: [PATCH v3 1/7] i2c: i2c-core-smbus: Expose PEC calculate function for generic use Date: Wed, 19 May 2021 14:49:28 +0700 Message-Id: <20210519074934.20712-2-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210519074934.20712-1-quan@os.amperecomputing.com> References: <20210519074934.20712-1-quan@os.amperecomputing.com> X-Originating-IP: [118.69.219.201] X-ClientProxiedBy: HK2PR04CA0081.apcprd04.prod.outlook.com (2603:1096:202:15::25) To MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from hcm-sw-17.amperecomputing.com (118.69.219.201) by HK2PR04CA0081.apcprd04.prod.outlook.com (2603:1096:202:15::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Wed, 19 May 2021 07:50:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a869516a-260f-4ffe-5fd7-08d91a9abfad X-MS-TrafficTypeDiagnostic: MW2PR0102MB3451: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3968; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cKJYc003RUYINxsr/3eLWSnIItakq5k34BDw5Px7GOcuMdOV83TumNEFwQpGa0TcK7UjWrlDSBxp3GoVrpqtjN6yqt4SjFL9+D+04eunZYNWuJ6F3pZAYL0f9lKRZVMA4i2gAQfA89yiOJkIExCIstw7BwCLm9KpyZDF/a4RlS70X4bqF4S7QKFqmqbxj0pv+0zgQf0cQLTq50fEQXUW8Y/e528YAnFGsn7Nu3d4BLkZyiX15x8kBrsIfZWl13bcVR25qQ8VxS9Qd3k0n+4FC3uEWafvzrCqGob6qrug1TEH7aTp+GVK3O5Nuo/oxlVpV7191UtFj0JTBPoAXrVefL0IwJNMvbsTieV+5LeQUY+z6GuMFuSt78FRurPYZzAXhYJDdzClmOoYyJZWA4r88U4b74Ja/+ODsrFVvlj+hOPFljDEzT+IE4mbc3tCHaA2oMs9Ib2XM9QCkv5r8jTAyA6hMyoSyBzOTaZND9cjPKmEBWZwAYzYh8WgCJepfXdT8vAla//1g7KYYTlqKlfdHNJ+F3HyG5TISIuujHAtvMMIPxLhdIDphVpWhD8L3nEbo42MkPyPrJMqkNtiwFLX3+oavJUGJkVnaBzznMm1rCQrr+tyV+o1FugCUff1f6y43QeYsG4+QjuUzFOUnuqD8Ar6MzS4P723NiV0HDlbbDDZwvG+u7tiz/8FskmIAGbM X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW2PR0102MB3482.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39850400004)(376002)(366004)(396003)(346002)(83380400001)(7416002)(8676002)(2906002)(921005)(6512007)(478600001)(38100700002)(8936002)(186003)(16526019)(38350700002)(52116002)(5660300002)(956004)(2616005)(4326008)(110136005)(54906003)(316002)(66556008)(66476007)(66946007)(6486002)(6506007)(1076003)(26005)(86362001)(6666004)(41533002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: augMxzP4NYET6V3Ie45SWy6VlDTdMfbw+bxBL96SVfQsH95A0cx6Mu9Rurv9mqAKT8aYXgDrV3oxnQlxC6RhpAhVzFXLdsQ2C6HedT7OrEsh9PLZKE71nTupJs8GOQ4kPGP+jBSdSHT5benVa8AeaS/L9xOatui8bL2UyVAf9F2nn15sdb1ixucF8qEmZyCEmgp4QoZoRUjnUVL8Z25/2Q2PiovpEpVWNCQcfiHEwRpBEEssOtfntheMtwyiv+RCu2D0ZiEr8LLs0yrOpvJpfgkr2dYzR0VK2lacgW+YRZwHqAqYF2ZoUoslSBJcBFDbA/p1kS13sBxNAXM2G0HNS1zyWRDZpyAQCOTLbSlzbFIJMQeOv9u6NoXwmnXYlgItdMSkuAXuSgml2r+10tCxejLCHUSY29ofnRJU77qf8wI7fdTPmWZcjuqDqkhvcOOOIt76E0cKScAodDY3CdlHYHW/wsfVvuNPe4fAr/ShVt27lsxoUONbN10iqf1Y3bQAFJvp7TuoddHoaNM1jTlN1oYSlHo5WsiqvWTcHowKae+MpWvklhUp0SmxbvuU1NBVZXsf0SNS2ZxycHzmy4P2prAirfLF7lo7EnllHtRhL0qH6sKPkTUbqfOYKRuiNOrvXEigbmzrg/F515UUpSaW5idTLSausV+vneTBRGSeg5ZC1gHpHMYDKpZtDPorPwRO0xzsuNcbKPxyVNDfBWpOuMUM/c7fpiM6MsP/SW8YyA4lIax0aYMVn0kV/3KJeErPDLTcrXsMwWhG+LIwYCLtKBldfPNN1ygsiFIYbATjCEQV/ZirQTSO/o+KpJlWgpBv6qcQpVzkXi65oZkIuu4HFKWuoahyvXNn4jOzFC193yCESRuRvDj9VA3sSJHzFvLqc+e8yxcxA4WmLANfPWDiagqVAewwlpdiOS0xn8tGu9SxZ7DZV+LfTO0FAecQTWdsr1FmZGUxU1QQxL6pcKXqHjHOgT3IYK/kQDoqCzDJkn6FtGmNmCS+f6K7pwvusJWBnNv5gmwIe8XHBEq5WfFMAe5Y7ZJrGOgiV9mHJBur4TYjzFMc319TgBsiWko1DStP+1Aaa3tqe5Af7wV5sLWoXq8nk16W9Igk37LgnjUtAtmFU7Jlij8Nw2ujX826yIf0V7ywcRfBgC8l+jO5koRRBS1fTwCehTLPX5AQMXzrjOn0la/WL7uf+CtT20TEUryZEfUYfbkIRzQnPj7A0k8ldmHXqGaP+phim8t0om4vmBz79K8/HNqBqm6Z4Yq+3ke4bBkFrJR79xRSbIUXCwTs1c/uzFjU697ktipJGK7rWsviIhn+QGudzeIwIyUpUucT X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: a869516a-260f-4ffe-5fd7-08d91a9abfad X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2021 07:50:19.7459 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9U89xkakyr5UHQH42/ugrphwgHFWOSkgvU2gmSvHw//47xWwx1ZucJ0jW7FXsUVlC5srfrx7Hra1Zf+linnmBIEO9DeXtTk3bbr6F+pYBdI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR0102MB3451 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_005026_512889_04BA0D83 X-CRM114-Status: GOOD ( 12.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Expose the PEC calculation i2c_smbus_pec() for generic use. Signed-off-by: Quan Nguyen --- drivers/i2c/i2c-core-smbus.c | 12 ++++++++++-- include/linux/i2c.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/i2c-core-smbus.c b/drivers/i2c/i2c-core-smbus.c index d2d32c0fd8c3..e5b2d1465e7e 100644 --- a/drivers/i2c/i2c-core-smbus.c +++ b/drivers/i2c/i2c-core-smbus.c @@ -37,8 +37,15 @@ static u8 crc8(u16 data) return (u8)(data >> 8); } -/* Incremental CRC8 over count bytes in the array pointed to by p */ -static u8 i2c_smbus_pec(u8 crc, u8 *p, size_t count) +/** + * i2c_smbus_pec - Incremental CRC8 over the given input data array + * @crc: previous return crc8 value + * @p: pointer to data buffer. + * @count: number of bytes in data buffer. + * + * Incremental CRC8 over count bytes in the array pointed to by p + */ +u8 i2c_smbus_pec(u8 crc, u8 *p, size_t count) { int i; @@ -46,6 +53,7 @@ static u8 i2c_smbus_pec(u8 crc, u8 *p, size_t count) crc = crc8((crc ^ p[i]) << 8); return crc; } +EXPORT_SYMBOL(i2c_smbus_pec); /* Assume a 7-bit address, which is reasonable for SMBus */ static u8 i2c_smbus_msg_pec(u8 pec, struct i2c_msg *msg) diff --git a/include/linux/i2c.h b/include/linux/i2c.h index e8f2ac8c9c3d..2494a007dfda 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -147,6 +147,7 @@ s32 __i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, /* Now follow the 'nice' access routines. These also document the calling conventions of i2c_smbus_xfer. */ +u8 i2c_smbus_pec(u8 crc, u8 *p, size_t count); s32 i2c_smbus_read_byte(const struct i2c_client *client); s32 i2c_smbus_write_byte(const struct i2c_client *client, u8 value); s32 i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command); From patchwork Wed May 19 07:49:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 12266577 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74485C433B4 for ; Wed, 19 May 2021 07:52:42 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 B382060FDC for ; Wed, 19 May 2021 07:52:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B382060FDC Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=os.amperecomputing.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=o1wPp/sha3PfSVgL5HYWmOHNqwai8jSWnc24aq68ep8=; b=lslnz41JOD43ofsdp0jGFyugo 2PpNGJHKJnYDiM/9vGfx9Xf8Q5dCt4pL4+VQ/EIVsxeC9HC1l0KHIgvbsCB5L3JKOyZRLLNWVZ0+Z TWRyaRFZpeJCcG9xON7PKvZRDDwL6N+NoZCMqxQSnlEEp5krr2XTJQKSToy0+8zdnu9iEq6mqvp9q SqRtfdErLmLsfbwxlAIA4wmKIgBObiiGHV+zE2YPgkijEW6ud9Pov9YV25m59IQVY0eV96ivbRSQJ riYjobIdF6kylX54ftqtlHEq+roA4US3NAUlnG7rn7ht9uiCpz4EMJB6X/jOwDRa5VlLrfRjj5/ws BIGz3vokA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyl-003EN0-2V; Wed, 19 May 2021 07:50:56 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyO-003EGs-60 for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 07:50:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version: Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Message-Id:Date :Subject:Cc:To:From:Sender:Reply-To:Content-ID:Content-Description; bh=nrb8L1WtoH37V8+qwYspJMUj716OqVakAWu2FslUZ1s=; b=bQutrcRcn5Rb0UkBkkq3as2u16 zzV1bB14D/dmGaCHr+cBf/qNkiKejbVzRLI+RkY1d+RTg2LkRjtkP8uDg+iIyBBY8vvN0GTCix3OA noqWoRgxnmu7QtRay8yzizHEUGt1RBU9pLDdm4toUMEjD0CAeaa4IcOvbLdC1TliTj3WbeHv6pEep T6q0GIk1ctichXdJEWKVmlf0t0OeeXdYSleAxQ/NhRGf1aUfUrOptdRrtrXvHTl22kcqONu2wFhCd 9VbTxwANOtBM44gM+PDIvqVCM+oYOPRwIW8lZr9BifSZElB83EgNp9xGv8kDsNgzA7AvqHNZRTrHu DsIOCFQA==; Received: from mail-dm6nam10on2124.outbound.protection.outlook.com ([40.107.93.124] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyJ-00FEbU-TE for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 07:50:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kGB+96JmxLztFaGSAiXwB13TH56xxWyHQiSbT4rbFxDkQ9A/dg+5yuCCHZZjGu63V7C/KbIDsQDo7fNvN/GMyyEf6ha86KB1Sf9q2xLIwA1MnaLvn0FnnqE2b1BOemfMxro18b0LD969xCs7WKuR8UA7kNat6HjYI/Dj1ArJeWZhDtO4hkEAAdh4G0V0bujWvTaD17ksSzGa6FkQNDng4Z+ULC8oXcfYO/I8NJR/TgCv1XU8kgOtm8UJ2/giBIs6t7u6aAgtWbA+YiTNxCGNOGxSmBmn7q5yKKRjV6L92ILUH1tl+LwR9TZi5M9RwzVT3G7h7EBrVekNmA3d0KZCjw== 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=nrb8L1WtoH37V8+qwYspJMUj716OqVakAWu2FslUZ1s=; b=GplRxl7ZXCxY+Df6eo2ZstL1nApMzdx8jpqFrcjvo1DQZli0VfRKae4J97ub8KlvfqGKN066EcT4t4ptqZpV0SP92fn+7oGgUNITSGEaaOrTNUHKLGV4cZI8GTcGvFz7LIX0zj2K8BBVDSYs3HRSu91dzhe4+HHsivOQJYGi4FyKKeS9Ei66nxABC2UuvMv+/427kGN5NoQmz7k+YvKpxGskRKvT3N9D6bxIyScK5ZZJBuzrVNZLV2odEyGsWNxrolTN+B2QAFvMfVyzlY/KptbiSteiAiDr29fYqs9VJGX3Be7tJk3ZV9wBm9c2yG8LxZfu5BLSh4J8/suGM46A8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nrb8L1WtoH37V8+qwYspJMUj716OqVakAWu2FslUZ1s=; b=OM/gImmBrgCj2y4B6LJh2++vudF4TYiV9UGvIE2AW9fvTsJcM5AJu0dUtO5n+u/+wsGluqvBjnzhPYrLhouv7rNk+2oKJVB2Pb7saMk2Av3u5C74YfpDRJam+jMjU+wz2CKCv9JtW/MKi+jMh4u1EpOIv2X3qjDhawDJhzHPBKE= Authentication-Results: acm.org; dkim=none (message not signed) header.d=none;acm.org; dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) by MW2PR0102MB3451.prod.exchangelabs.com (2603:10b6:302:10::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.28; Wed, 19 May 2021 07:50:24 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503%5]) with mapi id 15.20.4129.032; Wed, 19 May 2021 07:50:24 +0000 From: Quan Nguyen To: Corey Minyard , Rob Herring , Joel Stanley , Andrew Jeffery , Brendan Higgins , Benjamin Herrenschmidt , Wolfram Sang , Philipp Zabel , openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org Cc: Open Source Submission , Phong Vo , "Thang Q . Nguyen" , openbmc@lists.ozlabs.org Subject: [PATCH v3 2/7] ipmi: ssif_bmc: Add SSIF BMC driver Date: Wed, 19 May 2021 14:49:29 +0700 Message-Id: <20210519074934.20712-3-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210519074934.20712-1-quan@os.amperecomputing.com> References: <20210519074934.20712-1-quan@os.amperecomputing.com> X-Originating-IP: [118.69.219.201] X-ClientProxiedBy: HK2PR04CA0081.apcprd04.prod.outlook.com (2603:1096:202:15::25) To MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from hcm-sw-17.amperecomputing.com (118.69.219.201) by HK2PR04CA0081.apcprd04.prod.outlook.com (2603:1096:202:15::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Wed, 19 May 2021 07:50:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 454dce6f-02f6-48e3-4ed4-08d91a9ac276 X-MS-TrafficTypeDiagnostic: MW2PR0102MB3451: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C0M6BIoNbx8p8GkmRJAcJtaAmN5NoXA13aqHB3VDUEMTlkVuK7enGxW+QDGaSYNkEkxGlm7aa5PEpNwC1aM88C35EJigpSyqC3ycr5jZmANgH3GayDc3oR0dTUuTeH+Lxit4Gk9CGvLQxoMoEAL0GjFpfxuBjmap9HV55Q8JYBwg/WlC4zObtmtn3E8sEaPzXF3ybzULahIwk8jpvg6zDaZ3QF468TEilWuSAudzNh93tVJS6uedIs0lwpoShe9+lV9E6WeCjqKU/PmYWDNMz60pideiqoZCBW7dtNt5kIk35cqH70Dq9hdX/XApAdLnN2zwMAHq1lQ97+cPwQ+eiNsZ8CmsZFwCSjgx9v9Pt6GqfsBvqbJEOY5qv0NVZ73etldaz0d0louhR5STlzzXhe85si6WRg5EiSwM9IXH6pLBZ6OCH8uGmGBt0BwWTIPjTmRttP4BFQITxrH04T9J1Gm+0mK2QzJ06DSTkqkcvSEwQCptoT0mTrbQMJhZairGT8e2Hmj7FzoTND6jMIovvc0H4sk1eaFDfUD4QCw40cy7HCy79VBxSI4vAAdzFHMgtiCtfigYuEN2qhsA+etnW2LlBCxXnVRwaafWuuwWJ+E7ekjhZc68Ag7K66r0RlgrUQrRs11i2sVzIs10Js50sbAVwREfbu9qkTjaZgF8vXcFX8l4ReY726NYlcZc3dPiEXAH6qywgRYn0yynfCGrLI/YgVE6HfJlveFoh5WOxWpgBGG/tvx1FnlW9tWKQ3pNi6CFwliXVVV89NMyr+wtSzIcelypWjlg0Nr+ShEVb0pM5mRTPimrb1Jj00FUyvHO X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW2PR0102MB3482.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39850400004)(376002)(366004)(396003)(346002)(83380400001)(7416002)(8676002)(2906002)(921005)(6512007)(478600001)(38100700002)(8936002)(186003)(16526019)(38350700002)(52116002)(5660300002)(30864003)(956004)(2616005)(4326008)(110136005)(54906003)(316002)(66556008)(66476007)(66946007)(6486002)(6506007)(1076003)(26005)(86362001)(2004002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?RWlTUzDcgmJ1e14mi38mCFWNWll77P?= =?utf-8?q?75JQ6kxRDZ4O0Cke55IQmlYd4O/BNZmONJCRmZNlTtsXq1lY1UkYSnt3Ky6pEg2P3?= =?utf-8?q?uo0m229Qj8nQXTgnRNrhFQcb0CYpcmCfQRdP6CAa8Q0bmKt65NNLHWpuZH7h38GNF?= =?utf-8?q?F/1yyhUx4ycOIA/HzVm4peoTTloOg9LAduQ5CIFCcp/Vd93RvbbNJsxUScbIcFrZp?= =?utf-8?q?6RAGJzFgiBJvA8B7+7q2AqSC/xD3u5lf/moIJpzJLMHHN8tsa62WkTj/9vxiJF/AK?= =?utf-8?q?HjYqwJUbv+Li2kNhsMytFIqzYQJGwOv4IPA1FQL+stisI/hMcWf2mgzMOSYoKW39Z?= =?utf-8?q?nrHKq+9ukTGp5vV4mkb16sDSD5ZCVQududiKGqov6Gxx4iFvjUxGLbzlC44LZQrs8?= =?utf-8?q?x7exARsgYn//4AdVuSjNWhaJwZkn3xQUw/8JD43jkUi4xCBsX9Sc2FrxZLNIeuZXe?= =?utf-8?q?YWnXTypsXPDtAqMBL7xfclTi+oksLWyErLqCNMSGC2b6pI1ruUWNFxj1/Ua61LGE7?= =?utf-8?q?Hi1dPzV66PcOwPtLgfTVbEtls80zf1G3QwHg2PVH2pmsWeIhK/+HL/EVOyHqQQtUp?= =?utf-8?q?ZWDmjqZATJNlw2PzN5qPtzXxMk+kY0VyuoAl9N8E6M/kcAy/LB5XVrYbnhWUCVzLU?= =?utf-8?q?GEFJgalIkRW+tMX7C/1DFHsAdsJAZ5X+aLmNV5/koHzSoa846GJkhsw6RpKeisEpq?= =?utf-8?q?eybKbBzVlPvdJstrGZNEU7NNXpzA6ZT61VoAtnQx9Pwg1p6SOtRKrMuM4HjsvGOG2?= =?utf-8?q?+dM72ENf5jEcirQzaBL5str0ZU7OOwQnMzIdxPfAqUnMwcXL6rZHAECa+zBbOc7AQ?= =?utf-8?q?b91/VYoUVuhVQWojdVW+BqpEYc9w4tuH5ml9xiCAsPpTh5AeqwpfjRvMBDuaWMbJm?= =?utf-8?q?tYrqkZX95Clm5ZPeNdBKbxdpDXoOK1RD7jHJlaOMaEPsei1oaHTzVUtbx1U8EGs41?= =?utf-8?q?A8wL+ohWKixLY/hov4xfQ33TGX3SRQo7xP5USrVZHi17Q6GM+PKNFl0dSLxOHDggq?= =?utf-8?q?l1vrKgtP+/76677OYBTuTkd2rBdkJ6t1FnT26cveFdScs4Jy3pnl0vCWOScHKBwQD?= =?utf-8?q?gv2wmPi1g6Luz0UmMP8Bg67oa9F2g/xGZnhIFLj6OmZ89WmJRJrnSSajLfIzCOHcA?= =?utf-8?q?OpmVTFhPJ0GvKoaWj5e1PYWDWldzk4qvJfRHm1OvN1gYP+kdOVVS7ekZEYhibts3Y?= =?utf-8?q?ap3eljgkjP2Y54gD7k3KWZIBo4Hc1AAu/ciVheuiAf19ywI/xfg1x7hCXET9LzhOx?= =?utf-8?q?siBzoJhsHAKbBG?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 454dce6f-02f6-48e3-4ed4-08d91a9ac276 X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2021 07:50:24.3892 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pc/5iGx2aBw8ec9oCf81ZXQhNqvnkoNNNjCsJ9Ihd52vqrqdn82xqXe2NR4vokfJF/d0tsu0FXj6dis5JJvPnqlaAf6QLugE344HRmBAOM8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR0102MB3451 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_005027_990119_1FD0E06F X-CRM114-Status: GOOD ( 22.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The SMBus system interface (SSIF) IPMI BMC driver can be used to perform in-band IPMI communication with their host in management (BMC) side. Signed-off-by: Quan Nguyen --- v3: + Removed redundant license info [Joel] + Switched to use traditional if-else [Joel] + Removed unused ssif_bmc_ioctl() [Joel] + Made handle_request()/complete_response() to return void [Joel] + Refactored send_ssif_bmc_response()/receive_ssif_bmc_request() [Corey] + Removed mutex [Corey] + Use spin_lock/unlock_irqsave/restore in callback [Corey] + Removed the unnecessary memset [Corey] + Switch to use dev_err() [Corey] v2: + Fixed compiling error with COMPILE_TEST for arc drivers/char/ipmi/Kconfig | 11 + drivers/char/ipmi/Makefile | 1 + drivers/char/ipmi/ssif_bmc.c | 605 +++++++++++++++++++++++++++++++++++ drivers/char/ipmi/ssif_bmc.h | 93 ++++++ 4 files changed, 710 insertions(+) create mode 100644 drivers/char/ipmi/ssif_bmc.c create mode 100644 drivers/char/ipmi/ssif_bmc.h diff --git a/drivers/char/ipmi/Kconfig b/drivers/char/ipmi/Kconfig index 07847d9a459a..ad5c5161bcd6 100644 --- a/drivers/char/ipmi/Kconfig +++ b/drivers/char/ipmi/Kconfig @@ -133,6 +133,17 @@ config ASPEED_BT_IPMI_BMC found on Aspeed SOCs (AST2400 and AST2500). The driver implements the BMC side of the BT interface. +config SSIF_IPMI_BMC + tristate "SSIF IPMI BMC driver" + select I2C + select I2C_SLAVE + help + This enables the IPMI SMBus system interface (SSIF) at the + management (BMC) side. + + The driver implements the BMC side of the SMBus system + interface (SSIF). + config IPMB_DEVICE_INTERFACE tristate 'IPMB Interface handler' depends on I2C diff --git a/drivers/char/ipmi/Makefile b/drivers/char/ipmi/Makefile index 0822adc2ec41..d04a214d74c4 100644 --- a/drivers/char/ipmi/Makefile +++ b/drivers/char/ipmi/Makefile @@ -27,3 +27,4 @@ obj-$(CONFIG_ASPEED_BT_IPMI_BMC) += bt-bmc.o obj-$(CONFIG_ASPEED_KCS_IPMI_BMC) += kcs_bmc_aspeed.o obj-$(CONFIG_NPCM7XX_KCS_IPMI_BMC) += kcs_bmc_npcm7xx.o obj-$(CONFIG_IPMB_DEVICE_INTERFACE) += ipmb_dev_int.o +obj-$(CONFIG_SSIF_IPMI_BMC) += ssif_bmc.o diff --git a/drivers/char/ipmi/ssif_bmc.c b/drivers/char/ipmi/ssif_bmc.c new file mode 100644 index 000000000000..d0ea7059b1db --- /dev/null +++ b/drivers/char/ipmi/ssif_bmc.c @@ -0,0 +1,605 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * The driver for BMC side of SSIF interface + * + * Copyright (c) 2021, Ampere Computing LLC + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ssif_bmc.h" + +/* Handle SSIF message that will be sent to user */ +static ssize_t ssif_bmc_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) +{ + struct ssif_bmc_ctx *ssif_bmc = to_ssif_bmc(file); + struct ssif_msg msg; + unsigned long flags; + ssize_t ret; + + spin_lock_irqsave(&ssif_bmc->lock, flags); + while (!ssif_bmc->request_available) { + if (file->f_flags & O_NONBLOCK) { + ret = -EAGAIN; + goto out_unlock; + } + spin_unlock_irqrestore(&ssif_bmc->lock, flags); + ret = wait_event_interruptible(ssif_bmc->wait_queue, + ssif_bmc->request_available); + if (ret) + return ret; + spin_lock_irqsave(&ssif_bmc->lock, flags); + } + + count = min_t(ssize_t, ssif_msg_len(&ssif_bmc->request), + min_t(ssize_t, sizeof(struct ssif_msg), count)); + memcpy(&msg, &ssif_bmc->request, count); + ssif_bmc->request_available = false; + spin_unlock_irqrestore(&ssif_bmc->lock, flags); + + ret = copy_to_user(buf, &msg, count); + goto out; + +out_unlock: + spin_unlock_irqrestore(&ssif_bmc->lock, flags); +out: + return (ret < 0) ? ret : count; +} + +/* Handle SSIF message that is written by user */ +static ssize_t ssif_bmc_write(struct file *file, const char __user *buf, size_t count, + loff_t *ppos) +{ + struct ssif_bmc_ctx *ssif_bmc = to_ssif_bmc(file); + struct ssif_msg msg; + unsigned long flags; + ssize_t ret; + + if (count > sizeof(struct ssif_msg)) + return -EINVAL; + + ret = copy_from_user(&msg, buf, count); + if (ret) + return ret; + + if (!msg.len || count < ssif_msg_len(&msg)) + return -EINVAL; + + spin_lock_irqsave(&ssif_bmc->lock, flags); + while (ssif_bmc->response_in_progress) { + if (file->f_flags & O_NONBLOCK) { + ret = -EAGAIN; + goto out_unlock; + } + spin_unlock_irqrestore(&ssif_bmc->lock, flags); + ret = wait_event_interruptible(ssif_bmc->wait_queue, + !ssif_bmc->response_in_progress); + if (ret) + goto out; + spin_lock_irqsave(&ssif_bmc->lock, flags); + } + + memcpy(&ssif_bmc->response, &msg, count); + ssif_bmc->is_singlepart_read = (ssif_msg_len(&msg) <= MAX_PAYLOAD_PER_TRANSACTION + 1); + ssif_bmc->response_in_progress = true; + if (ssif_bmc->set_ssif_bmc_status) + ssif_bmc->set_ssif_bmc_status(ssif_bmc, SSIF_BMC_READY); + +out_unlock: + spin_unlock_irqrestore(&ssif_bmc->lock, flags); + +out: + return (ret < 0) ? ret : count; +} + +static int ssif_bmc_open(struct inode *inode, struct file *file) +{ + struct ssif_bmc_ctx *ssif_bmc = to_ssif_bmc(file); + int ret = 0; + + spin_lock_irq(&ssif_bmc->lock); + if (!ssif_bmc->running) + ssif_bmc->running = 1; + else + ret = -EBUSY; + spin_unlock_irq(&ssif_bmc->lock); + + return ret; +} + +static unsigned int ssif_bmc_poll(struct file *file, poll_table *wait) +{ + struct ssif_bmc_ctx *ssif_bmc = to_ssif_bmc(file); + unsigned int mask = 0; + + poll_wait(file, &ssif_bmc->wait_queue, wait); + + spin_lock_irq(&ssif_bmc->lock); + /* + * The request message is now available so userspace application can + * get the request + */ + if (ssif_bmc->request_available) + mask |= POLLIN; + + spin_unlock_irq(&ssif_bmc->lock); + + return mask; +} + +static int ssif_bmc_release(struct inode *inode, struct file *file) +{ + struct ssif_bmc_ctx *ssif_bmc = to_ssif_bmc(file); + + spin_lock_irq(&ssif_bmc->lock); + ssif_bmc->running = 0; + spin_unlock_irq(&ssif_bmc->lock); + + return 0; +} + +/* + * System calls to device interface for user apps + */ +static const struct file_operations ssif_bmc_fops = { + .owner = THIS_MODULE, + .open = ssif_bmc_open, + .read = ssif_bmc_read, + .write = ssif_bmc_write, + .release = ssif_bmc_release, + .poll = ssif_bmc_poll, +}; + +/* Called with ssif_bmc->lock held. */ +static void handle_request(struct ssif_bmc_ctx *ssif_bmc) +{ + if (ssif_bmc->set_ssif_bmc_status) + ssif_bmc->set_ssif_bmc_status(ssif_bmc, SSIF_BMC_BUSY); + + /* Request message is available to process */ + ssif_bmc->request_available = true; + /* + * This is the new READ request. + */ + wake_up_all(&ssif_bmc->wait_queue); +} + +/* Called with ssif_bmc->lock held. */ +static void complete_response(struct ssif_bmc_ctx *ssif_bmc) +{ + /* Invalidate response in buffer to denote it having been sent. */ + ssif_bmc->response.len = 0; + ssif_bmc->response_in_progress = false; + ssif_bmc->nbytes_processed = 0; + ssif_bmc->remain_len = 0; + wake_up_all(&ssif_bmc->wait_queue); +} + +static void set_multipart_response_buffer(struct ssif_bmc_ctx *ssif_bmc, u8 *val) +{ + u8 response_len = 0; + int idx = 0; + u8 data_len; + + data_len = ssif_bmc->response.len; + switch (ssif_bmc->smbus_cmd) { + case SSIF_IPMI_MULTIPART_READ_START: + /* + * Read Start length is 32 bytes. + * Read Start transfer first 30 bytes of IPMI response + * and 2 special code 0x00, 0x01. + */ + *val = MAX_PAYLOAD_PER_TRANSACTION; + ssif_bmc->remain_len = data_len - MAX_IPMI_DATA_PER_START_TRANSACTION; + ssif_bmc->block_num = 0; + + ssif_bmc->response_buf[idx++] = 0x00; /* Start Flag */ + ssif_bmc->response_buf[idx++] = 0x01; /* Start Flag */ + ssif_bmc->response_buf[idx++] = ssif_bmc->response.netfn_lun; + ssif_bmc->response_buf[idx++] = ssif_bmc->response.cmd; + ssif_bmc->response_buf[idx++] = ssif_bmc->response.payload[0]; + + response_len = MAX_PAYLOAD_PER_TRANSACTION - idx; + + memcpy(&ssif_bmc->response_buf[idx], &ssif_bmc->response.payload[1], + response_len); + break; + + case SSIF_IPMI_MULTIPART_READ_MIDDLE: + /* + * IPMI READ Middle or READ End messages can carry up to 31 bytes + * IPMI data plus block number byte. + */ + if (ssif_bmc->remain_len < MAX_IPMI_DATA_PER_MIDDLE_TRANSACTION) { + /* + * This is READ End message + * Return length is the remaining response data length + * plus block number + * Block number 0xFF is to indicate this is last message + * + */ + *val = ssif_bmc->remain_len + 1; + ssif_bmc->block_num = 0xFF; + ssif_bmc->response_buf[idx++] = ssif_bmc->block_num; + response_len = ssif_bmc->remain_len; + /* Clean the buffer */ + memset(&ssif_bmc->response_buf[idx], 0, MAX_PAYLOAD_PER_TRANSACTION - idx); + } else { + /* + * This is READ Middle message + * Response length is the maximum SMBUS transfer length + * Block number byte is incremented + * Return length is maximum SMBUS transfer length + */ + *val = MAX_PAYLOAD_PER_TRANSACTION; + ssif_bmc->remain_len -= MAX_IPMI_DATA_PER_MIDDLE_TRANSACTION; + response_len = MAX_IPMI_DATA_PER_MIDDLE_TRANSACTION; + ssif_bmc->response_buf[idx++] = ssif_bmc->block_num; + ssif_bmc->block_num++; + } + + memcpy(&ssif_bmc->response_buf[idx], + ssif_bmc->response.payload + 1 + ssif_bmc->nbytes_processed, + response_len); + break; + + default: + /* Do not expect to go to this case */ + dev_err(&ssif_bmc->client->dev, + "Error: Unexpected SMBus command received 0x%x\n", ssif_bmc->smbus_cmd); + break; + } + + ssif_bmc->nbytes_processed += response_len; +} + +/* Process the IPMI response that will be read by master */ +static void handle_read_processed(struct ssif_bmc_ctx *ssif_bmc, u8 *val) +{ + u8 *buf; + u8 pec_len, addr, len; + u8 pec = 0; + + pec_len = ssif_bmc->pec_support ? 1 : 0; + /* PEC - Start Read Address */ + addr = GET_8BIT_ADDR(ssif_bmc->client->addr); + pec = i2c_smbus_pec(pec, &addr, 1); + /* PEC - SSIF Command */ + pec = i2c_smbus_pec(pec, &ssif_bmc->smbus_cmd, 1); + /* PEC - Restart Write Address */ + addr = addr | 0x01; + pec = i2c_smbus_pec(pec, &addr, 1); + + if (ssif_bmc->is_singlepart_read) { + /* Single-part Read processing */ + buf = (u8 *)&ssif_bmc->response; + + if (ssif_bmc->response.len && ssif_bmc->msg_idx < ssif_bmc->response.len) { + ssif_bmc->msg_idx++; + *val = buf[ssif_bmc->msg_idx]; + } else if (ssif_bmc->response.len && ssif_bmc->msg_idx == ssif_bmc->response.len) { + ssif_bmc->msg_idx++; + *val = i2c_smbus_pec(pec, buf, ssif_msg_len(&ssif_bmc->response)); + } else { + *val = 0; + } + /* Invalidate response buffer to denote it is sent */ + if (ssif_bmc->msg_idx + 1 >= (ssif_msg_len(&ssif_bmc->response) + pec_len)) + complete_response(ssif_bmc); + } else { + /* Multi-part Read processing */ + switch (ssif_bmc->smbus_cmd) { + case SSIF_IPMI_MULTIPART_READ_START: + case SSIF_IPMI_MULTIPART_READ_MIDDLE: + buf = (u8 *)&ssif_bmc->response_buf; + *val = buf[ssif_bmc->msg_idx]; + ssif_bmc->msg_idx++; + break; + default: + /* Do not expect to go to this case */ + dev_err(&ssif_bmc->client->dev, + "Error: Unexpected SMBus command received 0x%x\n", + ssif_bmc->smbus_cmd); + break; + } + len = (ssif_bmc->block_num == 0xFF) ? + ssif_bmc->remain_len + 1 : MAX_PAYLOAD_PER_TRANSACTION; + if (ssif_bmc->msg_idx == (len + 1)) { + pec = i2c_smbus_pec(pec, &len, 1); + *val = i2c_smbus_pec(pec, ssif_bmc->response_buf, len); + } + /* Invalidate response buffer to denote last response is sent */ + if (ssif_bmc->block_num == 0xFF && + ssif_bmc->msg_idx > (ssif_bmc->remain_len + pec_len)) { + complete_response(ssif_bmc); + } + } +} + +static void handle_write_received(struct ssif_bmc_ctx *ssif_bmc, u8 *val) +{ + u8 *buf; + u8 smbus_cmd; + + buf = (u8 *)&ssif_bmc->request; + if (ssif_bmc->msg_idx >= sizeof(struct ssif_msg)) + return; + + smbus_cmd = ssif_bmc->smbus_cmd; + switch (smbus_cmd) { + case SSIF_IPMI_SINGLEPART_WRITE: + /* Single-part write */ + buf[ssif_bmc->msg_idx - 1] = *val; + ssif_bmc->msg_idx++; + + break; + case SSIF_IPMI_MULTIPART_WRITE_START: + /* Reset length to zero */ + if (ssif_bmc->msg_idx == 1) + ssif_bmc->request.len = 0; + + fallthrough; + case SSIF_IPMI_MULTIPART_WRITE_MIDDLE: + case SSIF_IPMI_MULTIPART_WRITE_END: + /* Multi-part write, 2nd byte received is length */ + if (ssif_bmc->msg_idx == 1) { + ssif_bmc->request.len += *val; + ssif_bmc->recv_len = *val; + } else { + buf[ssif_bmc->msg_idx - 1 + + ssif_bmc->request.len - ssif_bmc->recv_len] = *val; + } + + ssif_bmc->msg_idx++; + + break; + default: + /* Do not expect to go to this case */ + dev_err(&ssif_bmc->client->dev, + "Error: Unexpected SMBus command received 0x%x\n", ssif_bmc->smbus_cmd); + break; + } +} + +static bool validate_pec(struct ssif_bmc_ctx *ssif_bmc) +{ + u8 rpec = 0, cpec = 0; + bool ret = true; + u8 addr, index; + u8 *buf; + + buf = (u8 *)&ssif_bmc->request; + switch (ssif_bmc->smbus_cmd) { + case SSIF_IPMI_SINGLEPART_WRITE: + if ((ssif_bmc->msg_idx - 1) == ssif_msg_len(&ssif_bmc->request)) { + /* PEC is not included */ + ssif_bmc->pec_support = false; + return true; + } + + if ((ssif_bmc->msg_idx - 1) != (ssif_msg_len(&ssif_bmc->request) + 1)) + goto error; + + /* PEC is included */ + ssif_bmc->pec_support = true; + rpec = buf[ssif_bmc->msg_idx - 2]; + addr = GET_8BIT_ADDR(ssif_bmc->client->addr); + cpec = i2c_smbus_pec(cpec, &addr, 1); + cpec = i2c_smbus_pec(cpec, &ssif_bmc->smbus_cmd, 1); + cpec = i2c_smbus_pec(cpec, buf, ssif_msg_len(&ssif_bmc->request)); + if (rpec != cpec) { + dev_err(&ssif_bmc->client->dev, "Bad PEC 0x%02x vs. 0x%02x\n", rpec, cpec); + ret = false; + } + + break; + case SSIF_IPMI_MULTIPART_WRITE_START: + case SSIF_IPMI_MULTIPART_WRITE_MIDDLE: + case SSIF_IPMI_MULTIPART_WRITE_END: + index = ssif_bmc->request.len - ssif_bmc->recv_len; + if ((ssif_bmc->msg_idx - 1 + index) == ssif_msg_len(&ssif_bmc->request)) { + /* PEC is not included */ + ssif_bmc->pec_support = false; + return true; + } + + if ((ssif_bmc->msg_idx - 1 + index) != (ssif_msg_len(&ssif_bmc->request) + 1)) + goto error; + + /* PEC is included */ + ssif_bmc->pec_support = true; + rpec = buf[ssif_bmc->msg_idx - 2 + index]; + addr = GET_8BIT_ADDR(ssif_bmc->client->addr); + cpec = i2c_smbus_pec(cpec, &addr, 1); + cpec = i2c_smbus_pec(cpec, &ssif_bmc->smbus_cmd, 1); + cpec = i2c_smbus_pec(cpec, &ssif_bmc->recv_len, 1); + /* As SMBus specification does not allow the length + * (byte count) in the Write-Block protocol to be zero. + * Therefore, it is illegal to have the last Middle + * transaction in the sequence carry 32-bytes and have + * a length of ‘0’ in the End transaction. + * But some users may try to use this way and we should + * prevent ssif_bmc driver broken in this case. + */ + if (ssif_bmc->recv_len != 0) + cpec = i2c_smbus_pec(cpec, buf + 1 + index, ssif_bmc->recv_len); + + if (rpec != cpec) { + dev_err(&ssif_bmc->client->dev, "Bad PEC 0x%02x vs. 0x%02x\n", rpec, cpec); + ret = false; + } + + break; + default: + break; + } + + return ret; +error: + /* Do not expect to go to this case */ + dev_err(&ssif_bmc->client->dev, + "Error: Unexpected length received %d\n", ssif_msg_len(&ssif_bmc->request)); + + return false; +} + +static void complete_write_received(struct ssif_bmc_ctx *ssif_bmc) +{ + u8 cmd = ssif_bmc->smbus_cmd; + + /* A BMC that receives an invalid PEC shall drop the data for the write + * transaction and any further transactions (read or write) until + * the next valid read or write Start transaction is received + */ + if (!validate_pec(ssif_bmc)) { + dev_err(&ssif_bmc->client->dev, "Received invalid PEC\n"); + return; + } + + if (cmd == SSIF_IPMI_SINGLEPART_WRITE || cmd == SSIF_IPMI_MULTIPART_WRITE_END) + handle_request(ssif_bmc); +} + +static void initialize_transfer(struct ssif_bmc_ctx *ssif_bmc, u8 *val) +{ + /* SMBUS command can vary (single or multi-part) */ + ssif_bmc->smbus_cmd = *val; + ssif_bmc->msg_idx++; + + if (ssif_bmc->smbus_cmd == SSIF_IPMI_SINGLEPART_WRITE || + ssif_bmc->smbus_cmd == SSIF_IPMI_MULTIPART_WRITE_START) { + /* + * The response can be delayed in BMC causing host SSIF driver + * to timeout and send a new request once BMC slave is ready. + * In that case check for pending response and clear it + */ + if (ssif_bmc->response_in_progress) { + dev_err(&ssif_bmc->client->dev, + "Warn: SSIF new request with pending response"); + complete_response(ssif_bmc); + } + } else if (unlikely(ssif_bmc->smbus_cmd != SSIF_IPMI_SINGLEPART_READ && + ssif_bmc->smbus_cmd != SSIF_IPMI_MULTIPART_WRITE_MIDDLE && + ssif_bmc->smbus_cmd != SSIF_IPMI_MULTIPART_WRITE_END && + ssif_bmc->smbus_cmd != SSIF_IPMI_MULTIPART_READ_START && + ssif_bmc->smbus_cmd != SSIF_IPMI_MULTIPART_READ_MIDDLE)) { + /* Unknown command, clear it */ + dev_err(&ssif_bmc->client->dev, "Warn: Unknown SMBus command"); + complete_response(ssif_bmc); + } +} + +/* + * Callback function to handle I2C slave events + */ +static int ssif_bmc_cb(struct i2c_client *client, enum i2c_slave_event event, u8 *val) +{ + unsigned long flags; + struct ssif_bmc_ctx *ssif_bmc = i2c_get_clientdata(client); + + spin_lock_irqsave(&ssif_bmc->lock, flags); + + /* I2C Event Handler: + * I2C_SLAVE_READ_REQUESTED 0x0 + * I2C_SLAVE_WRITE_REQUESTED 0x1 + * I2C_SLAVE_READ_PROCESSED 0x2 + * I2C_SLAVE_WRITE_RECEIVED 0x3 + * I2C_SLAVE_STOP 0x4 + */ + switch (event) { + case I2C_SLAVE_READ_REQUESTED: + ssif_bmc->msg_idx = 0; + if (ssif_bmc->is_singlepart_read) + *val = ssif_bmc->response.len; + else + set_multipart_response_buffer(ssif_bmc, val); + break; + + case I2C_SLAVE_WRITE_REQUESTED: + ssif_bmc->msg_idx = 0; + break; + + case I2C_SLAVE_READ_PROCESSED: + handle_read_processed(ssif_bmc, val); + break; + + case I2C_SLAVE_WRITE_RECEIVED: + if (ssif_bmc->msg_idx) + handle_write_received(ssif_bmc, val); + else + initialize_transfer(ssif_bmc, val); + + break; + + case I2C_SLAVE_STOP: + if (ssif_bmc->last_event == I2C_SLAVE_WRITE_RECEIVED) + complete_write_received(ssif_bmc); + /* Reset message index */ + ssif_bmc->msg_idx = 0; + break; + + default: + break; + } + ssif_bmc->last_event = event; + spin_unlock_irqrestore(&ssif_bmc->lock, flags); + + return 0; +} + +struct ssif_bmc_ctx *ssif_bmc_alloc(struct i2c_client *client, int sizeof_priv) +{ + struct ssif_bmc_ctx *ssif_bmc; + int ret; + + ssif_bmc = devm_kzalloc(&client->dev, sizeof(*ssif_bmc) + sizeof_priv, GFP_KERNEL); + if (!ssif_bmc) + return ERR_PTR(-ENOMEM); + + spin_lock_init(&ssif_bmc->lock); + + init_waitqueue_head(&ssif_bmc->wait_queue); + ssif_bmc->request_available = false; + ssif_bmc->response_in_progress = false; + + /* Register misc device interface */ + ssif_bmc->miscdev.minor = MISC_DYNAMIC_MINOR; + ssif_bmc->miscdev.name = DEVICE_NAME; + ssif_bmc->miscdev.fops = &ssif_bmc_fops; + ssif_bmc->miscdev.parent = &client->dev; + ret = misc_register(&ssif_bmc->miscdev); + if (ret) + goto out; + + ssif_bmc->client = client; + ssif_bmc->client->flags |= I2C_CLIENT_SLAVE; + + /* Register I2C slave */ + i2c_set_clientdata(client, ssif_bmc); + ret = i2c_slave_register(client, ssif_bmc_cb); + if (ret) { + misc_deregister(&ssif_bmc->miscdev); + goto out; + } + + return ssif_bmc; + +out: + devm_kfree(&client->dev, ssif_bmc); + return ERR_PTR(ret); +} +EXPORT_SYMBOL(ssif_bmc_alloc); + +MODULE_AUTHOR("Chuong Tran "); +MODULE_AUTHOR("Quan Nguyen "); +MODULE_DESCRIPTION("Linux device driver of the BMC IPMI SSIF interface."); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/char/ipmi/ssif_bmc.h b/drivers/char/ipmi/ssif_bmc.h new file mode 100644 index 000000000000..eab540061f14 --- /dev/null +++ b/drivers/char/ipmi/ssif_bmc.h @@ -0,0 +1,93 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * The driver for BMC side of SSIF interface + * + * Copyright (c) 2021, Ampere Computing LLC + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef __SSIF_BMC_H__ +#define __SSIF_BMC_H__ + +#define DEVICE_NAME "ipmi-ssif-host" + +#define GET_8BIT_ADDR(addr_7bit) (((addr_7bit) << 1) & 0xff) + +#define MSG_PAYLOAD_LEN_MAX 252 + +/* A standard SMBus Transaction is limited to 32 data bytes */ +#define MAX_PAYLOAD_PER_TRANSACTION 32 + +#define MAX_IPMI_DATA_PER_START_TRANSACTION 30 +#define MAX_IPMI_DATA_PER_MIDDLE_TRANSACTION 31 + +#define SSIF_IPMI_SINGLEPART_WRITE 0x2 +#define SSIF_IPMI_SINGLEPART_READ 0x3 +#define SSIF_IPMI_MULTIPART_WRITE_START 0x6 +#define SSIF_IPMI_MULTIPART_WRITE_MIDDLE 0x7 +#define SSIF_IPMI_MULTIPART_WRITE_END 0x8 +#define SSIF_IPMI_MULTIPART_READ_START 0x3 +#define SSIF_IPMI_MULTIPART_READ_MIDDLE 0x9 + +struct ssif_msg { + u8 len; + u8 netfn_lun; + u8 cmd; + u8 payload[MSG_PAYLOAD_LEN_MAX]; +} __packed; + +static inline u32 ssif_msg_len(struct ssif_msg *ssif_msg) +{ + return ssif_msg->len + 1; +} + +#define SSIF_BMC_BUSY 0x01 +#define SSIF_BMC_READY 0x02 + +struct ssif_bmc_ctx { + struct i2c_client *client; + struct miscdevice miscdev; + u8 running; + u8 smbus_cmd; + struct ssif_msg request; + bool request_available; + struct ssif_msg response; + bool response_in_progress; + /* Response buffer for Multi-part Read Transaction */ + u8 response_buf[MAX_PAYLOAD_PER_TRANSACTION]; + /* Flag to identify a Multi-part Read Transaction */ + bool is_singlepart_read; + u8 nbytes_processed; + u8 remain_len; + u8 recv_len; + /* Block Number of a Multi-part Read Transaction */ + u8 block_num; + size_t msg_idx; + enum i2c_slave_event last_event; + bool pec_support; + /* spinlock */ + spinlock_t lock; + wait_queue_head_t wait_queue; + void (*set_ssif_bmc_status)(struct ssif_bmc_ctx *ssif_bmc, unsigned int flags); + void *priv; +}; + +static inline struct ssif_bmc_ctx *to_ssif_bmc(struct file *file) +{ + return container_of(file->private_data, struct ssif_bmc_ctx, miscdev); +} + +struct ssif_bmc_ctx *ssif_bmc_alloc(struct i2c_client *client, int sizeof_priv); + +#endif /* __SSIF_BMC_H__ */ From patchwork Wed May 19 07:49:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 12266585 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57447C433B4 for ; Wed, 19 May 2021 07:53:40 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 DDF5660FE4 for ; Wed, 19 May 2021 07:53:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DDF5660FE4 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=os.amperecomputing.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xXDEjfNIaYGqZoulI/YWxwpb//lXLUFIn8mZcF3fbA0=; b=WzT3mmf0gxwMMrEkHRtAd57gd 4TzyfcjG4rxKrWHcEC9BxDyadFSx1LLAFXQlFJaEmRKdZ0qQD4B2JBd+rLim1aXKP+1tkrWg/AFl7 sQs9kW1XgTVQWD2Z2+QFMpFCp8x3qHvGgh1/gzHK8Y3aJK1qvzDN4/XcS/dTBV/QKweYlvBKmJHKi +XHQRdC0DxaSIG0XOW/Y55S2wWNuthlzrDQVIlAJaxRL+qPoExqga+H2frMzXEwWvL/EwRNry/iz1 6eVOvOrarDK1oNN7prJottSRwTdl8tcjN7yWfV8rTfjkIY6OGrE91RHS0oH4EsI3TIeRyxKBzVKpV ljNWhuk2g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljGz1-003ERm-OI; Wed, 19 May 2021 07:51:12 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyR-003EHo-Tm for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 07:50:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=7KHjQAaGdHpGdNvvbzuJGuZ8UawLP9ToZSEP3o/2wTQ=; b=sLJiFfVMi+1BgzrJtmODv+ZYtS dQwiVVVpvftlryh7jG8mtANk74q5WBtKpXd8nH3O8c93/d5QmwxsFgh55ld3hsqAnwOZvYqkQC1f8 4jeffvvKRBt4j46hsfMZNHEwIvlr3OhjmmlVUHhGcAxqkVgGzN7WdhMQkce/YduYpzoy6T01VTMoS YP49UULUH/AakZHK0NJn5/2gbFch4D88CVnA5h0fvsuh1ThyWrD0/ypZoe88glhtkVizaZQJjv7gI oIV9Xk/UYuq4x7CFL39JjPtwj5ItdsYn8MOFnZKXqgo94L1CZArhqyxAiGS2QZOtII4Iab229BG9X k6bm9IWw==; Received: from mail-bn8nam08on2095.outbound.protection.outlook.com ([40.107.100.95] helo=NAM04-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyP-00FEdZ-9a for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 07:50:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=THLW2dX9kCkAUH/EI6VUh1mwNXOmmFqHCNJDQOyf98ntT2f25WuMhqoC34emVyD9pxCXb540HMeTm3aXXiDQbaZYvVdoOZklaFyNspwiY1ZM/aw4/rujWmbU/rnkCAWhBg/iqEv56NpMYTXDQBOVDs9S7RZGjgPn85Ky0FKQRlqo3CW04XhhVuYVO1sVhZkHDfbDFG/h+wgKTO4qwXDXor+fQQgj2DtokL5467R5qkolPc/SClHMv7CS0x2slDxp353gDbt+ySe0HhM6Z0bHNre3wiRYfXgZ6eH7sNJFNXt/jE8q6PACRMjsC8eCHdKmYoqqtDqLiUTyStlBsMG9ig== 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=7KHjQAaGdHpGdNvvbzuJGuZ8UawLP9ToZSEP3o/2wTQ=; b=TaUSWqmF/pQNC2DZTxbUdkn/w5L026D9QpOc+qsN5WNj+6R+Ug/5276KX1HHbDg9oU6exphwYSVvO6lpSOslQestLgBVMTkATfVL14QEuq2qbuXDeFe6elX3mJebcW1NoWRRbPX2LWDrEPwH8K1D7v6QU2z6gfHBQFMs18ySpuLizbH5xmaoHBD5uQKohyyYxnP2DxYMH4+Dz5uJeLtKZRxmX6E7RiGSBVuAActcQEytfLSoKa+VXqID6bJkNMxpp/CGkjTX9czkJqHzvoGF3ajdWQ3x7C9i6XEu3L7d/opdmOkU4aVryT2GEXKFEeqBrDFUb8nqNxvpSgKAAqqJaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7KHjQAaGdHpGdNvvbzuJGuZ8UawLP9ToZSEP3o/2wTQ=; b=qAkSPCAzIcYjupKtTG3ro4HuprK77ttOMWz7IQpYU7KUoAxiBQ5EveeNpiIg94nyG+BWy1ypamIjzTQ04deOay0M9KY9mntCC76Q3DpMasZvciyoWL5VHO7RveI6v0/LIROV3s55GCUOaNe8JpvzQB5DHJ5UBPnrXVhHXpCFvSQ= Authentication-Results: acm.org; dkim=none (message not signed) header.d=none;acm.org; dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) by CO1PR01MB6743.prod.exchangelabs.com (2603:10b6:303:d5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.26; Wed, 19 May 2021 07:50:28 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503%5]) with mapi id 15.20.4129.032; Wed, 19 May 2021 07:50:28 +0000 From: Quan Nguyen To: Corey Minyard , Rob Herring , Joel Stanley , Andrew Jeffery , Brendan Higgins , Benjamin Herrenschmidt , Wolfram Sang , Philipp Zabel , openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org Cc: Open Source Submission , Phong Vo , "Thang Q . Nguyen" , openbmc@lists.ozlabs.org Subject: [PATCH v3 3/7] i2c: aspeed: Fix unhandled Tx done with NAK Date: Wed, 19 May 2021 14:49:30 +0700 Message-Id: <20210519074934.20712-4-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210519074934.20712-1-quan@os.amperecomputing.com> References: <20210519074934.20712-1-quan@os.amperecomputing.com> X-Originating-IP: [118.69.219.201] X-ClientProxiedBy: HK2PR04CA0081.apcprd04.prod.outlook.com (2603:1096:202:15::25) To MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from hcm-sw-17.amperecomputing.com (118.69.219.201) by HK2PR04CA0081.apcprd04.prod.outlook.com (2603:1096:202:15::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Wed, 19 May 2021 07:50:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eb7697dd-ba48-44c1-1fcb-08d91a9ac4fe X-MS-TrafficTypeDiagnostic: CO1PR01MB6743: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:883; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FSJV3uBMPQ7RmLE32JVMGuIfXCeIY1j673onb3zpu4/pbhjR6wIPm08eYn7L9rMpGwt5ga5Aoaj7rEgPc7o+CaF82m43DBq6+BHixTXM4ioj/ARDqbmR/ZVWA77F2NMnHwgkRlSFv6cmTBDS/hVS2v+Gvok/4oF3+qCalBHh4IpsO8UAMOrm1m/vcRCPxM6RfAWGUw6A9BqSeDTcC1VEmnVEBhGBPGStsF+AN/qJ2my1/1ZKEwYV1efgJSz/OGwee9PGHvZAF0ElFNNrqWyp/Dh01pQgXjNYjHwuyA8TAPkenZ7AUHaxVitjzYFFjpc7WNqaTG81lWN9vo+QfaIEulwJH92V/zgCz+uGxDbPgMBeqwL9wQ6KSGcr0HSKe0fG/PTzPc5RCpdutFlX+2g6SyqQg9xXET3yDxjq2Uh5MhGgkrSz3k/xQWQa8oVLeTz0+OsoSLMv85CoE/gATpbrSIUXrY1322CVi9GGdWUbYDDFUf4wvymwJR+IUu/U5tdR5VEj8ZzsVIgJ4QmNIjFPw3pWaeG26FyJVS+7WJnztpA3mMvnbfZsUNIIKmH1Q3xq7liALcl4lzT8Wu7vqpYVU0jQuW/4iL9PF4DbO+Fn8eA8CuR1bAx4Veg1aZvZ+5OV1p6RJ03oDodb9yhHKymu4cCKINI9uWXihYNkDkzFUVY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW2PR0102MB3482.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39850400004)(376002)(136003)(346002)(396003)(478600001)(66946007)(66476007)(8676002)(8936002)(956004)(921005)(66556008)(52116002)(6506007)(2616005)(6512007)(5660300002)(86362001)(4326008)(38100700002)(1076003)(38350700002)(7416002)(316002)(83380400001)(186003)(6666004)(2906002)(110136005)(54906003)(6486002)(16526019)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: wOYRpQOmJcfHfJaUkClI1GlyQlYdeDohKEQzEQ7aFIkfSl5SWxOPKUMzd/AGHB0Pptg5hfVSVQV+fcZcvBXPDtCGJYUwNkP1WHfMnSfzITr/sndTIBsy2iv0Nux2kQVndqtABM8rsB4FQVietBP0uncyo7i2Rn3HjWa3h6Gxys/TqHzMW+zISZpeYG3CyCzud7tdk59g2iE0WAVc9sX/505uYti2oBvktDu8bVQ1EVhjE8S3R8kLuXQn13hSsBMwRIY/kB7P/h/YIpiRIXdCSTnOwbRH9ZNAFwpGci1qzNEkpjmef8n9ZSD2TCZ57HIpMxmUNP4eRdVP4aPFTA6zB1zhUKwvKXX0CEdr9gUYDm/ltVMUN4MOHw9JdcwQMyIrA1HK7alhyJDAO8c1rrF+bOGmnchr4pzFcnJWeR4iBmPWN3vUNxJ4m3e7j/zn4kXkH1kXcDTmxk5TanwkTzlWthUrQTBedS0TxeKgx6Yl93xntmaMWSgGV+VaP02u+e7aq3U4HOkDEhEumE82+tnBCyFgEx8GKoOkTyZuXyeukEAup+Ug26gfoiTrocQw7lyfKyTVRF23pr1zyhuZD6IgcAAZvTzsbVqRmni5qS5Ww4ytd+hmOMPKOHQKau22cFpm450C0fgIG8XUWdRyeNSgnMhqUbJrlVQlw771teEJUNYk+K6CFUkcJbrKb/7E7cWkQjks/1aZ8qFvV5I6n4sTOGRdGu42YniO9S+KDjnVzYsSsUuqbb2TI5Bc6wcJ+c0FmNfiy6PAbumDAH0u0SAX1Bc9a0ayzJPnrdh/Z9lPYHVxJqdquLRwiUGmiKpu9E5GJ1zSFdsC3GZgY1IS7WAbyl9CbtpOch7tI9n8kHMeymZqfMcfWUOG8QVJIWcq6lHhz2WkBvFkvCVAEQ3GdKjR0sZNS3FQ+Iuod75hKH97D2CDxgc2srsb6cdzWrwP7Nr3gOauvNk/phoLroLvMTO5O/VCIoYliUWlSxMp9nXPVLTwSNIkgrpvwsVvbIqGqFCwJTONJCh3GoRyh6qKrMacA1a+seAe5b+LCMppeuV9zDqBBRhk72rsv62XkWSxvPtFlzD+phUh44WZ127c/PkqCPjE3eDA45JRBYtO0rZXd2chbJVjbQRpFwkXheibMdZfUxsE5gPBo7cSdWoMik62Yp1lsN0Zm2ewUYFrO8X9uOWhuXp9To6psHMZ8ObWmTKcSivVb8fwENpgY+6n45qgRYTKhJiDvqv5yKf25H6Fmfu+cYLOxmHy98miq8BJSX+L+JXk4UtHern1Bvm3GzAbGse47lB8tRLcoyhbcQxE35U44rtcf3CHBzVY2IAK+1LI X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb7697dd-ba48-44c1-1fcb-08d91a9ac4fe X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2021 07:50:28.5608 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1IczHUF6dArYxwUftFSiMa7jrxXmwOqXqFFmjXriZy/h6eo/ChC0WLveLhjZLaIL+7AulsekDd054toQunh75Fuc++ei5oCYeaRM4+CQoi0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR01MB6743 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_005033_360022_ADB9ADDE X-CRM114-Status: GOOD ( 12.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It is observed that in normal condition, when the last byte sent by slave, the Tx Done with NAK irq will raise. But it is also observed that sometimes master issues next transaction too quick while the slave irq handler is not yet invoked and Tx Done with NAK irq of last byte of previous READ PROCESSED was not ack'ed. This Tx Done with NAK irq is raised together with the Slave Match and Rx Done irq of the next coming transaction from master. Unfortunately, the current slave irq handler handles the Slave Match and Rx Done only in higher priority and ignore the Tx Done with NAK, causing the complain as below: "aspeed-i2c-bus 1e78a040.i2c-bus: irq handled != irq. expected 0x00000086, but was 0x00000084" This commit handles this case by emitting a Slave Stop event for the Tx Done with NAK before processing Slave Match and Rx Done for the coming transaction from master. Signed-off-by: Quan Nguyen --- v3: + First introduce in v3 [Quan] drivers/i2c/busses/i2c-aspeed.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c index 724bf30600d6..3fb37c3f23d4 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -254,6 +254,11 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) /* Slave was requested, restart state machine. */ if (irq_status & ASPEED_I2CD_INTR_SLAVE_MATCH) { + if (irq_status & ASPEED_I2CD_INTR_TX_NAK && + bus->slave_state == ASPEED_I2C_SLAVE_READ_PROCESSED) { + irq_handled |= ASPEED_I2CD_INTR_TX_NAK; + i2c_slave_event(slave, I2C_SLAVE_STOP, &value); + } irq_handled |= ASPEED_I2CD_INTR_SLAVE_MATCH; bus->slave_state = ASPEED_I2C_SLAVE_START; } From patchwork Wed May 19 07:49:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 12266581 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B36FFC433ED for ; Wed, 19 May 2021 07:53:10 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 44FBE60FDC for ; Wed, 19 May 2021 07:53:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 44FBE60FDC Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=os.amperecomputing.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EbfWxNCpl7A6/mxBOV+r/x+SNKUyONWza1eifVqsDYg=; b=OWMcvzOOW0O5DJynDnVw0SkOU 4Ksf1oWY/K0JkM+PY9Zmt8FfdtE25tZcIOmErpM88zLu6rjU7TqUUWYmAzaQpJvvPZcq91jeUd0NU nEA45VgYbqTUtrVD5kYn7sm3bn5aRoWpXIgmEO+hJpWHvBCbQfE+t8L8J8N5ZEJJAGaCpN/rEZcLv eSiHDNbKL/wkkhb1Yo+Q0lMDQ2luSWV3kDYX5tkFmI5soQSn1pH3kiCcjm1z55mpyotYjaQ5LQWOw QrDD60V3qTgdH0kQ46PW4SV8By9I3CojOjSTQkXb5jC0d0ZZqz42pp7qZxIImEnVbqxNfDffQsfuQ OisNZhWaQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljGzJ-003EXn-FU; Wed, 19 May 2021 07:51:29 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyT-003EIC-HJ for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 07:50:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=vje+03qevVU6+32AS/CatzC60RQwdsWneb80iFwSmC4=; b=eFO+jewvi8+0a/sNzS74sfj+fO +9ONzKo4rwy/h4KxTvaMZ1lP2bbmQW4ayQw38I8OlYDpMyxN7DtOVWkoKLCaX0e8Pg23TbUARFUsf HM+ydW0R4Jq8iFLPosVKkxnASZp9eONnZnn0dhRbc69EquUCGuFMRsh3BEM6zvnbFlTzned4aC5A6 OAp66ZZ0yL5w8Pici8N6KFMcWK9Njm30KUqFfkyYHngJ+LyBqKGhlFWONRDMxEpJafpiEy7wC/h8C UgC/NhgnQEFDnESr6Yf+eb83KtIb88y+Acq49DHzJ4a7jYc6EGoCE6EstNKY1WdcU3HjQva8AQWeN sxIQiSdQ==; Received: from mail-bn8nam08on2095.outbound.protection.outlook.com ([40.107.100.95] helo=NAM04-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyQ-00FEdZ-Vw for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 07:50:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XQvmGutb/vHC8DS+xxGsvISJZ58En5zJX+GACGLfri9h9cZO9jwX7U89zc6eGJIP9ytAZjhOzFwuojIH3TY1WCqePMnoTSfK0a+4e3R//GSm4NQpDV582yvFyLZIvTtG9CQlcb259IBrMe7/h6/mek6ZWSdKCHZFwrYSj35kHCVL9xHM5CoqWGVyaqxtsauoeSf9Wa9ro6dB0bb01f2F4JSvoDBQoGhTf1jLoBaPmxd5Bj0/XthprpDaxaJN9Wcn9kV6hap/K2XtWUg0Lggw/s8+3WJIW3mhSlRHDtF+l5JI4XBscxwbdzFsjtvlswSvxsngj0q7X0XwvfIkkhFopA== 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=vje+03qevVU6+32AS/CatzC60RQwdsWneb80iFwSmC4=; b=HHHrZfGHgRmx3JloaPkZRZlr+mn246qHZu9WgHoscFLPcyzvi0pHwmoZqmqEdNKEgGbRpE+1Ez8Dffbukvv165XN8Nr6NrJYwbpED8yzG0+kAS0fXrUsLrPXgQrAs2fz0K2oKEF3ngfDwO7+YdAW0z5TcRdRLTteaajV7Bft+Ine+XrpoP6DNREwYo9RNlhUAuJKpJZ5zPtE1t4Q9AqK5Nc3x0dzHpQ9fvXMs8s+OlTLayTCiYNhLtS/bZi9O8SoNS7XwCyZtncSlLLhPG1Zivr/9Ej9c1nsLn67Rf4gW8tN3XEZcYaRvDdtN9mL2KLvV2jNzPFNYuJGUJb889WjCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vje+03qevVU6+32AS/CatzC60RQwdsWneb80iFwSmC4=; b=HubBXMIMmRJo1Zqj0Nc1J4or3rOJp6wwVZoHb6p1zIY2z5/6aaLWZ03mtlnqZlZ1EFCGO8QGXiOgdeteUkaFV6VcbOYdYMw+hwCO7B4jtCLRRbdAljD+KYUX+9hu8PLICm73/wZ7BBijZuhdhAa3fbheGZJCs8p96e64zveGWzA= Authentication-Results: acm.org; dkim=none (message not signed) header.d=none;acm.org; dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) by CO1PR01MB6743.prod.exchangelabs.com (2603:10b6:303:d5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.26; Wed, 19 May 2021 07:50:33 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503%5]) with mapi id 15.20.4129.032; Wed, 19 May 2021 07:50:32 +0000 From: Quan Nguyen To: Corey Minyard , Rob Herring , Joel Stanley , Andrew Jeffery , Brendan Higgins , Benjamin Herrenschmidt , Wolfram Sang , Philipp Zabel , openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org Cc: Open Source Submission , Phong Vo , "Thang Q . Nguyen" , openbmc@lists.ozlabs.org Subject: [PATCH v3 4/7] i2c: aspeed: Acknowledge Tx done w/wo ACK irq late Date: Wed, 19 May 2021 14:49:31 +0700 Message-Id: <20210519074934.20712-5-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210519074934.20712-1-quan@os.amperecomputing.com> References: <20210519074934.20712-1-quan@os.amperecomputing.com> X-Originating-IP: [118.69.219.201] X-ClientProxiedBy: HK2PR04CA0081.apcprd04.prod.outlook.com (2603:1096:202:15::25) To MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from hcm-sw-17.amperecomputing.com (118.69.219.201) by HK2PR04CA0081.apcprd04.prod.outlook.com (2603:1096:202:15::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Wed, 19 May 2021 07:50:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f2418c50-8fee-4f63-f5ea-08d91a9ac77a X-MS-TrafficTypeDiagnostic: CO1PR01MB6743: 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: jLJkJWUfLVVr+Uhc5cxc8v0KDPPJUSi6Z1MCHljoB+nOCpV5cf1kJBubvqNInG/msDAgy2yveBCTGTnQFOpt0o1cgz4+emPNgTQHWDv7wbRAI5Pz4r19XvHT9VkxMaK8g4HEEZeCEmppNm3aAUa4iRftllqe+aGFLo8nEWzqXFwDbfNNwejFtGmCaU/upNchfj76575m4mx2RrSN6blyeQlkkbIJhUcc3G5c0o8MU7f+vVFu4R9inZL4s6SvgnGThyvTcLndl2P9vyMUQvSdDzRZicIrdvW5ERx1K6ieswVGO7qJWfZji7NWztdrOBhNSHgOZqHvMlMKcnY5wfXeche7dQCtV5Uf7MoUFlEorIDsQOfzz9iyl2xRkkvwAAUpdclxkkei+irFn5il6PW018VHbNGxAbzRuweYTJ//+lXK3WO8tqNqTDIvmiEs5X18aD38n1u7jOJdNnnz3FnCIG8fjmlVVAvfrw3dhE9BSPLGOcvb2Joh32xK0rr4Q+FQyTm2UVXf+3grw+5I8h2xmQizAgySLTjKLi5rd3BlS5Vngzqja9YoKnbeHqPhkYpemeQ73tshGmaCEZbzxEu1ESSIRzrZEhAaUQYpouG0JMHk91oaplcZNtPQ4zaJoQdxgHXkDA/cFhRszVndhVHXVDMnQU0m3E176ABBHrddGsU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW2PR0102MB3482.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39850400004)(376002)(136003)(346002)(396003)(478600001)(66946007)(66476007)(8676002)(8936002)(956004)(921005)(66556008)(52116002)(6506007)(2616005)(6512007)(5660300002)(86362001)(4326008)(38100700002)(1076003)(38350700002)(7416002)(316002)(83380400001)(186003)(6666004)(2906002)(110136005)(54906003)(6486002)(16526019)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: ToJVO/5iyna5eBVqkey+8GgyoobcAhBGvp8J9YzXSuTS0KJfn+qHqnNANG+7YI/pO94rJAsRN+tUlLveluytVVsj0GAICtv8dYeJFBlL4OJkN1JkwLGLwZvA7L2dQuXMUo1RtKSQHHSsGCL/k0d5A5CDIJmz1Cz7ldF4mkJgfHp5c6BMDFisTJk2mq8BADHsjspdQwcMvpqJvRedJUURbO/5Ekf/MEybz9aw1qv5Z6hjdIgptm3gVCEm+aBH995E9xQ0QIJ7iG4vUX4zGwc8ylhfbr5m+pV+vmFQYmI7N6zPLhFW/r9j1AOFFssiqfc7BBiR3w4ileBnI5BGGYdeACyOeqhZiMIM273YwQvtHvfW4mHqVDEhMuJllMn+GwGHHo8J28rfB7m9X8ZufnzviELtwN5DUSXwALVHtZD1obDko7USo20BbJaw5HEWMl8ZzJiX4OnK9vcwnMT1RmcS1OTGJVUkBh2oSoduwiDlGjS5zZXk91ArPNZB5sSTfBY03fa17nvo7pwJdiFOA8/C1eKo29LHLHaLwvKkXuQSFk4FXKuCgildKvefSymMxU7GDAsPbdAMcqLD5B0VlU5ejHYhlIPU3nPUxH4tdI3TqbBU/K2TP/O/fXKnAu7ZKSxXPCHsnd2+kCXQSZaJ+sav9Qwufh5JIS3HX4zCzNUXyQkMgsEQvuNxrJDWGadwwWwdIyOWA6Q244I0uww5ehNcAwOYDdRVvuSG5KBvhMnADbo7e/ChgJIqtc5TcoX4P1iqJLcOIopmde7RPlulP9wCZp0Cz+0e12mN34FnMSKvjbvixxpWFla0EzpMY9Z12KYZBX6IJ972zdX8/h5oZCWhweCUpAl01NlhGVcVXqN76OCXei5aLAMrZILf7akMmGneKWUMZ/0g04jjnQqZT6gMaautfc+Bty2uz77mG4HvugNBZEggT1ec9KHAj3FEl+mF16wK0qNcMp6LCeAuImYGD+RJhC0wGd8uVnx0Qt+HIDRj0EoOyaw6b1/z0zw8ZvVhYIFe3ajFtC03ZkiG8CcJj7dW7vI9Mw1TUz4b8UVbh9aMcPCN2POHEqResaGOyh6fthOFsDZc24er/cadB2LJfN6rykO8Jrp9LjSRNUegXjRm10cRqYasFhKFypkQTHDom6nrvfnMppJH8wgS1k5gzvMpSn9JL4duV8jnDHKSqS4vhe57mUm6gndR15tHRsRmrkGRPebKLUVooY+z7DIJcUaBj61a/p9w4jyh8d4Q6ctEOJwwoFI84zZcVB5JaPxkDycOCPa3pJ4sfvwozkdvWbev07ynVPmjc/Dhc/5jQxqp1Ho+WRH7y99NlaVi0gSi X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2418c50-8fee-4f63-f5ea-08d91a9ac77a X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2021 07:50:32.8243 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NluZkF8BB6Dj0Got2FxuiLIIpzRq7sW2PEK5Bu3qB+1SliDKYNXPGZJhNvqtmjQnICMw/5dMufmHte+h+4G+NRqzgEQjkdeDPHoPV5v0lg8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR01MB6743 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_005035_050570_B3AEDE68 X-CRM114-Status: GOOD ( 13.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org With Tx done w/wo ACK are ack'ed early at beginning of irq handler, it is observed that, usually, the Tx done with Ack irq raises in the READ REQUESTED state. This is unexpected and complaint as below appear: "Unexpected Ack on read request" Assumed that Tx done should only be ack'ed once it was truly processed, switch to late ack'ed this two irqs and seen this issue go away through test with AST2500.. Signed-off-by: Quan Nguyen --- v3: + First introduce in v3 [Quan] drivers/i2c/busses/i2c-aspeed.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c index 3fb37c3f23d4..b2e9c8f0ddf7 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -606,8 +606,12 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) spin_lock(&bus->lock); irq_received = readl(bus->base + ASPEED_I2C_INTR_STS_REG); - /* Ack all interrupts except for Rx done */ - writel(irq_received & ~ASPEED_I2CD_INTR_RX_DONE, + /* + * Ack all interrupts except for Rx done and + * Tx done with/without ACK + */ + writel(irq_received & + ~(ASPEED_I2CD_INTR_RX_DONE | ASPEED_I2CD_INTR_TX_ACK | ASPEED_I2CD_INTR_TX_NAK), bus->base + ASPEED_I2C_INTR_STS_REG); readl(bus->base + ASPEED_I2C_INTR_STS_REG); irq_received &= ASPEED_I2CD_INTR_RECV_MASK; @@ -652,12 +656,18 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) "irq handled != irq. expected 0x%08x, but was 0x%08x\n", irq_received, irq_handled); - /* Ack Rx done */ - if (irq_received & ASPEED_I2CD_INTR_RX_DONE) { - writel(ASPEED_I2CD_INTR_RX_DONE, - bus->base + ASPEED_I2C_INTR_STS_REG); - readl(bus->base + ASPEED_I2C_INTR_STS_REG); - } + /* Ack Rx done and Tx done with/without ACK */ + /* Note: Re-use irq_handled variable */ + irq_handled = 0; + if (irq_received & ASPEED_I2CD_INTR_RX_DONE) + irq_handled |= ASPEED_I2CD_INTR_RX_DONE; + if (irq_received & ASPEED_I2CD_INTR_TX_ACK) + irq_handled |= ASPEED_I2CD_INTR_TX_ACK; + if (irq_received & ASPEED_I2CD_INTR_TX_NAK) + irq_handled |= ASPEED_I2CD_INTR_TX_NAK; + writel(irq_handled, bus->base + ASPEED_I2C_INTR_STS_REG); + readl(bus->base + ASPEED_I2C_INTR_STS_REG); + spin_unlock(&bus->lock); return irq_remaining ? IRQ_NONE : IRQ_HANDLED; } From patchwork Wed May 19 07:49:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 12266583 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65149C433ED for ; Wed, 19 May 2021 07:53:38 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 E58B860FE4 for ; Wed, 19 May 2021 07:53:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E58B860FE4 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=os.amperecomputing.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=R4rRH83Q4C6xAHjt3uL7x9NtzM+DVUWXy5xrRPMSqMw=; b=EHLWe7PFECQTMyZrcCngl7UO5 Lw7yjFDxjG7sVZEfN/1yfwgodhVWg1CCAf/hbByaLLROYZFzd57HNX7dfIfQqRdNx5czGWfFotJoz jBmeK3R6fuANlubC9n5lzQNyor7LkXd11NZH/1Y69/XZpwreGipDGgFP5vzeM8RPZuscGF5psEbJ/ XicsmuVgh9jnqiK/686ynYF60Y6o1rp9pryFohuOCvl52RkpDTvSoauu3f1gN+RR7FtbOa8u/CXhs J4ggOAqLPVLy4l6/dWIxcre+xNhXc2ibBQvfLe69fQg6uhj7NudQM0cs2bsMeD4tIGGvo7ruoM/8P jaEI5LJdQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljGzm-003EiX-4E; Wed, 19 May 2021 07:51:59 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyY-003EJa-JH for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 07:50:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=PqBAtez2bYEYPVr1UA+6yYTcfsTkQ8Jef38beg1HuNw=; b=4zDGeUGHUIUa9mCPpKm5oymVeU bHqUEoR3xOVnyGtHFoY9nrDIJQ0aKpd2+cuwfb0pnAsOKPy4xVpKKDycwtzH1jQoJskJqIJxprjtc W52IvEVp3Ye78uhQ4j/DawEc7klXtNHuPEfNdiTCsbJiqqCT+X626gDfF+iUXZsWQabZSfL4y1AyU TSNxWJz4EZ/xC9tEzEdGNQT3oeGazBCyKvjFh3LcWZ7fql8aQ5+i0Qvs45loy0VWr1m9UYdzK5TN4 Ef4ExF/sdtNJ5Ddeh3NDtGt/s1NIukTlM44y59nXFBgdeuorRnuRzwqowYh/GG0iE5pp9Z1ymBovS kbF3MYTg==; Received: from mail-bn8nam08on2131.outbound.protection.outlook.com ([40.107.100.131] helo=NAM04-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyV-00FEep-GP for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 07:50:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FPhr7e3zmtVVcw6QJXZiMftQUWOCry1TuCeqXL4QkheTlqpB4nehIAiSdxsE/3wNvUSco4W7T5I67ZPMpIq8N5C4KfkzdkVuyFvnlp9TPGiBvvc2xjEKk6Z0gtk6wuwnNJ7C6qCJzgX0C4PGBVBM8SMgTAzfMEymExMJ2gGGJT/TXL5olGE88bMHvWRN4RWzJvNGcSUkVSENwEvvA35o/YsnzpnrV15/D9hsJ2AublELT7BGhC/aIrSra8XOYWx8o5vu4YBNWmQBzk7LJy6cXnTBtvtSYQlgXF2AjuxDN+XhStzdbyheDRtW9RaPBY3KhOVkFZUwCvhDchtM7uRuyA== 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=PqBAtez2bYEYPVr1UA+6yYTcfsTkQ8Jef38beg1HuNw=; b=OszkteslzvFbttq7oXJLoKUFrAWBbB9IQtT4aRuLplZ2NUE9y1OnoMtac6rgRytMp4Kx7MGSHng+TCEzRUHaN0nfFguGm9M6Y60Xvq1uRwi9q+St1ZxodOPsSw1Kkd48ic9VhquP4RmrTRVcek1IZYpnvct+TGp4x4sHvqh7DKr0MWL6NWgtthl1sD5GseOspIBIBTP5QUOf+f+ok8Am8fRZIDs6QwjDWX0AD1aghq7Y5YoRkaTH9gfFVmNZ5nP/liaqqsnJbfkf6cL7F/XedxRZNg6k6fZSZeUTyZ0uOSYBSPRohxJqQLkaUq7/qJlib/yLKYw7sVtXPWzoC4+6bA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PqBAtez2bYEYPVr1UA+6yYTcfsTkQ8Jef38beg1HuNw=; b=AXy/CmkEHESFFrRqk7UHuNZydzz+6M90JEu6uNHLauF/+fboFqePZoyK//rA2pkmJ8gBblqVXy7bSpB0xcaYoVHQHoEOAEqvwMcynuZT8QHgS5MVaaC6J9dzaToz9j79sCZRXGjh+Z4tUSg/aaKIuejhKa8BKXPRO2B5zPV4/8c= Authentication-Results: acm.org; dkim=none (message not signed) header.d=none;acm.org; dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) by CO1PR01MB6743.prod.exchangelabs.com (2603:10b6:303:d5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.26; Wed, 19 May 2021 07:50:37 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503%5]) with mapi id 15.20.4129.032; Wed, 19 May 2021 07:50:37 +0000 From: Quan Nguyen To: Corey Minyard , Rob Herring , Joel Stanley , Andrew Jeffery , Brendan Higgins , Benjamin Herrenschmidt , Wolfram Sang , Philipp Zabel , openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org Cc: Open Source Submission , Phong Vo , "Thang Q . Nguyen" , openbmc@lists.ozlabs.org Subject: [PATCH v3 5/7] i2c: aspeed: Add aspeed_set_slave_busy() Date: Wed, 19 May 2021 14:49:32 +0700 Message-Id: <20210519074934.20712-6-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210519074934.20712-1-quan@os.amperecomputing.com> References: <20210519074934.20712-1-quan@os.amperecomputing.com> X-Originating-IP: [118.69.219.201] X-ClientProxiedBy: HK2PR04CA0081.apcprd04.prod.outlook.com (2603:1096:202:15::25) To MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from hcm-sw-17.amperecomputing.com (118.69.219.201) by HK2PR04CA0081.apcprd04.prod.outlook.com (2603:1096:202:15::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Wed, 19 May 2021 07:50:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3f34fae3-c945-4d1c-e4f8-08d91a9aca06 X-MS-TrafficTypeDiagnostic: CO1PR01MB6743: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 95jn109+m3nocENwElxyrjFodaRMaJicDBnx+WxHCrXfLGUeiSgxZxcNPgHlYRI2Zmw2NlSzhEzS20Ke+0gwF+PM50Dvru8fMVKl2diI+Eb41Pknhf10OVSFlJ3c+4S/K8wlxtnNbOv+80hh34ALoGJXU4ef/hS2w3EOO67Kb+PyWwCNxMSxhJoilNpk872cBIwI+RmEsKzGj9aqNu44nwpWvMJ3IiFmyEAQlPLRnwvL9DsBG+Z4G701Gt2HS3U678QpGMpNqo9FClYKAhubBUdIFXHpr2e8hAinEDJE+wfDAXFiSnh2OMpe/eWApeySGU6AqUSYns4E+UNDOIIg5PpOFAkH/mvcTc8yY/q54aSOFteNzj1L9hkION52U31iT5XhJmX8mgNjQvf1LCY0QaaKxDHDwO7RFEyf7B0051tkItdQUwPcfl+enRtuGhvQkpKDgFQc/pkHJtNf7gS6eM36KZ6LrRG+rwjHWq3n8nFbXvHel237JrX8yq3ueQgmjTizQ3/tcJb+Ls5fwhN9x3lDPK0xybhvv5Xh2xCJ97f+RkL4vRMC0wYlm8zx3GF0hazXYeqoAJaUkKbfh+0s5gm1vggFWKpNmHtYbcZ1AsUteQQze0jh64rtEr8CG90P7vqlMmbIHLkhScf/jIx0pxx4D/gJQcWpI++ItUINymo= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW2PR0102MB3482.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39850400004)(376002)(136003)(346002)(396003)(478600001)(66946007)(66476007)(8676002)(8936002)(956004)(921005)(66556008)(52116002)(6506007)(2616005)(6512007)(5660300002)(86362001)(4326008)(38100700002)(1076003)(38350700002)(7416002)(316002)(83380400001)(186003)(2906002)(110136005)(54906003)(6486002)(16526019)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: wf/tLFUZ8IECaMNchEzq6ikeZPCoXVSce7cpTgRoTH1XX0sEjfmm68uXdXZ+wQbQAn3lyefXZM0JNPZf92bcaG+xWUd8/J3LJf22GCy2HlmlkhQ0UD/nJ7Sh7RsJBjud9cU+E+q87MHqu/uz4ihxBo16HNp00mafJYUf1bFG7sz947s/5D75Mtqy5We5HY0UMV0KHSGKMR6zZgXkqcLgDdOsqPBNKQ9UEqzt3IThyW9gn6jvhHfHF3vG1MLpIgWOKN5wcOKD6vVW6Mhxr7bSgQw6pGIENMQSjJIenN6/NNC3MRk8X2t5quoH6i5zsggSrMPjNZWn8eCOaiKi1af/ftyBJnDC8eRQzNN1VbcabipICm8ordWPW9UTgD9Wac1h8PjyFOz4VRwGMdl/Xz1pdziK23Gh5opDAuDCNFUdbg5/oOhcO1TLU+/iq9L0aITjAgLN+5mPTRzgbLBGigtgqxU6yOoYeHPhTifejIcup8DTRwok9+HnDFcWSRj6U4zXoBvraAqXgKubBZvlRFYrJkGhJFPuEzl69MM9nEDmf3zmULm8Vbm1uRl/h6BAH5ZRTnzsmrdMtzQANLm3V15U6u2AL1TF97kJKzjJzuyC/oyx4q3N9SmAoulRb40heQmCi5ZCFcXzlyNZMdJ/asrL4v7zwqnH5tIElbxDrpY2se9H0y6xYD/BZ/UbWBbczch2yAJMWyge9jmtDuypgM15V/BY7tGfL0w7PrhiHxGoTkMxKWRDl0400s32bq3QfuoNEWboE+c9OT7QUI9ZyfslskUeAQhU3tM6sQwleFy2THIAhkDy2p7vK3hst9i2H4lAsrIylA8fgo7kTas9aV5yjfpamNpqT1GVWvTy3H6U+nEEKJ1Eb2JJmz+g+MCBbi5sxjetE/5bocc9U+dUmQQ0+pmfOiofu4zSePO5hWqUor3mjQRSEfhDr3ZAUtrIUu9siAylBl0eueekLMpsHW2PZTSfNcAGZtl5Bblq/EF5G/78xtEtIi8Dw+HfheAIbYgKkNje86rROOswDTKxUbDIvxYa/CG1rohrOI9OvEPQ5/OWKz4eBuczsWcXYlvwUSGu1cDdIG6HTnYHhyonqQ9wdrgz1l4SKRXcHubK/nrgL6mUJlwMJ5c9B7WHqBqDPdGQp4fQ2mCZxocD63hG/Rt01cfwVHXEeVDOdWPit6LGRTA0BSdiYXMRFDdFIj8/XSEUXunEqUHYjcf2cJqH9J/9jD5erdx7ZzbiUDNTGg8iKIqFrO3EhW+r7gVouUI20I5rJDZX9JR/oxEJdl/oxgCktmu5p4swoQzcgRg/lqh/Fw4236bTgoE65Ve9K9vtaHv5 X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f34fae3-c945-4d1c-e4f8-08d91a9aca06 X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2021 07:50:36.9439 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ls50jwrku7MN6VDAh2fBVqEr5u3Z0GVgx/IOzpQiv0IUP5IwjI6mmYyWv3//P7bjrnD/RpAknDDkCPOngNHJEtMkhX5oLsVV8k7wOliULsE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR01MB6743 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_005039_569076_08DDD009 X-CRM114-Status: GOOD ( 11.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Slave i2c device on AST2500 received a lot of slave irq while it is busy processing the response. To handle this case, adds and exports aspeed_set_slave_busy() for controller to temporary stop slave irq while slave is handling the response, and re-enable them again when the response is ready. Signed-off-by: Quan Nguyen --- v3: + First introduce in v3 [Quan] drivers/i2c/busses/i2c-aspeed.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c index b2e9c8f0ddf7..9926d04831a2 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -944,6 +944,26 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, return 0; } +#if IS_ENABLED(CONFIG_I2C_SLAVE) +void aspeed_set_slave_busy(struct i2c_adapter *adap, bool busy) +{ + struct aspeed_i2c_bus *bus = i2c_get_adapdata(adap); + unsigned long current_mask, flags; + + spin_lock_irqsave(&bus->lock, flags); + + current_mask = readl(bus->base + ASPEED_I2C_INTR_CTRL_REG); + if (busy) + current_mask &= ~(ASPEED_I2CD_INTR_RX_DONE | ASPEED_I2CD_INTR_SLAVE_MATCH); + else + current_mask |= ASPEED_I2CD_INTR_RX_DONE | ASPEED_I2CD_INTR_SLAVE_MATCH; + writel(current_mask, bus->base + ASPEED_I2C_INTR_CTRL_REG); + + spin_unlock_irqrestore(&bus->lock, flags); +} +EXPORT_SYMBOL_GPL(aspeed_set_slave_busy); +#endif + static int aspeed_i2c_reset(struct aspeed_i2c_bus *bus) { struct platform_device *pdev = to_platform_device(bus->dev); From patchwork Wed May 19 07:49:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 12266587 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F289C433B4 for ; Wed, 19 May 2021 07:54:14 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 C214860FDC for ; Wed, 19 May 2021 07:54:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C214860FDC Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=os.amperecomputing.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0Hum3K7zRqpE8768i3B9hdOiJfYDgj/Xckw6ZsdtUSY=; b=QNWs5U8qt3n82nekH7SHiNvXQ IAFJQ4iwCKa+naVWT3O7cfU5CHqrAtgv6X+gxxTtlWYXINM+fe6cny/RWegt45gzBdNqPEeG9mjj4 WTGWVHYeZ5GafNxO1nxtgo04dsIdxx0I7N2nznwfF1FSwZcvEBadLX1tEA/mZ8NXXe1f0WiKj2e+/ huZlEOSlCISMZJxfeN3eHWV+vZlzzTdU1qxQhnl4UbUvGz4Km8Aw1O12R/dBepxAHDz3bzODDYrnY tONINKGMJuhJYV05UHlNrpuRPLQz2mRV6GaHb7yoL5rXet2Vrmm35jRwj8VU4eWWmZNPuvLky3b32 ZvfSUFm/g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljH0E-003Esh-Eh; Wed, 19 May 2021 07:52:27 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyc-003EKi-PP for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 07:50:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=72qcUnPpdP0uEVnitS/qqBhvFc0fw0fVzMWmHey7FGA=; b=KUY4QX4N1IKIItwvdsE5X3nWSI QnO5rF0LT8M0rPELhx1xZICRA9OEAZJR86nNY75+HSxM5tVHvkRUv+Y2iDt9OSqVvKDEqwGtawIiw uQVlLAxEzPSfd2qqqVjk1RcTwmRUxjlCMjUB2/IXoudT9eUZfZ7qu/oLk94zMQQzixsoshbNc5q40 GfYE/PKe7Kq+v9WF6JcmzwCyAuvCMjyuaTfyxitS58yz0TACrFKaxN3pA6TRMUYWnNbr23L/WIK6B Z5L+k0cOC4cOQ+RHhqKH+LEzk4XKQ/F2tDyk35DYRRbd062utbUvL/fWt5MTPGCvSUO5Xp4On9r9t E5vm5xHg==; Received: from mail-bn8nam08on2091.outbound.protection.outlook.com ([40.107.100.91] helo=NAM04-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljGya-00FEfU-3y for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 07:50:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mmo1ucoAErzFkDermmw7nrZHuPeNrNs8nLo+viP5O5oglfa5xJ8RaGjfhgDbNjX2n1Y4jLEQoRKva5VBocu5JNGltqktpAjftK/b8/+mztqgHcVJUFh7oxWhribYZo8OZ6ONNuCxDbL/meOr2jD2MHXjXFN4XjJa8yQudSrP2M8mMCusJ5t0zdhzZW9vjQsB4WF/4omrmRdzPGywcneUG8pvKwbhvNHhVBQNvygSuTWV5Tt0KbYXHLWwwx1xI9JNkdtKsG4GOGbB0TvAapqxaZvSw0itP0eu9FQ2aKsUh1ZvoY3EVFwh5tPJ/U9UCu+iboEr0AXyMyyoFxt0DwSh0w== 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=72qcUnPpdP0uEVnitS/qqBhvFc0fw0fVzMWmHey7FGA=; b=MxdiJjzVImpZmiVT+it9jIuFk3u4UgLwdRgQq5gbk3tztnQYzVmKiRwyJk4T4n1duuRBVZH94jYI6+bY5R6/sXOgq4qDY6lz5hJyv/9PTKAWezWWH8Oz+zVF62EAjoNGgGE+DPdMYjcTO1wROdqqiQzijlEXRqz4KK9UQcd6ucYL6ROU612PtazrxJfNFNB1igi3IfwMvW3dGwXD2LXUgJjg4tNAuF0ie2xYNq1kTmjH3fDrGQ9wDEnTFuSx2fYUZt6G/O81pWvYGF/8M0qLsdq2rgB0vVpIGBDCgjo+eNOkXn2Ac9rCGYqhI++dXNj+ofeX+2f95jSHybWwmbtwSQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=72qcUnPpdP0uEVnitS/qqBhvFc0fw0fVzMWmHey7FGA=; b=TR51DahRdRYzr13diEQLnqXIfulqcsqHDPA2AjOZVRELRV/A2+gUcOSrbOvf0YN6df/t7xwavnZ3PAVCNydVWkjBnx5HbbW+vSGZ090Il/9+OcqUtBuW/6m1GXFDxcotNCMEwq4RYhYc6A+6DDyly4Kadsx7U5Z3qVE7W1s0SDE= Authentication-Results: acm.org; dkim=none (message not signed) header.d=none;acm.org; dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) by CO1PR01MB6743.prod.exchangelabs.com (2603:10b6:303:d5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.26; Wed, 19 May 2021 07:50:41 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503%5]) with mapi id 15.20.4129.032; Wed, 19 May 2021 07:50:41 +0000 From: Quan Nguyen To: Corey Minyard , Rob Herring , Joel Stanley , Andrew Jeffery , Brendan Higgins , Benjamin Herrenschmidt , Wolfram Sang , Philipp Zabel , openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org Cc: Open Source Submission , Phong Vo , "Thang Q . Nguyen" , openbmc@lists.ozlabs.org Subject: [PATCH v3 6/7] ipmi: ssif_bmc: Add Aspeed SSIF BMC driver Date: Wed, 19 May 2021 14:49:33 +0700 Message-Id: <20210519074934.20712-7-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210519074934.20712-1-quan@os.amperecomputing.com> References: <20210519074934.20712-1-quan@os.amperecomputing.com> X-Originating-IP: [118.69.219.201] X-ClientProxiedBy: HK2PR04CA0081.apcprd04.prod.outlook.com (2603:1096:202:15::25) To MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from hcm-sw-17.amperecomputing.com (118.69.219.201) by HK2PR04CA0081.apcprd04.prod.outlook.com (2603:1096:202:15::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Wed, 19 May 2021 07:50:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 27675c48-38e8-47a8-9dad-08d91a9acc76 X-MS-TrafficTypeDiagnostic: CO1PR01MB6743: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:608; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jmQbRJyqkQsM3HQxPPe2ExOMpCGWdYyELMlPs26DRO879XiSDdEoqZsb86upnnOCTQYcXP+zsV+Yw4Juk+/PDZolpnwzHAUYZXwhhmAnZt1jK85EgP7La1+vO/8q07YYCwHIkbHc15Nrg3GyFEBSTFhnwO4fggneSUa6Yh6z6CjsmDJ0EBONuXZTJUEZmI29D6it9nA98y/qI16++cyMDWppwH5hldqdLVRWX6rmpXwN/GCa+RKyLahjsYqSFVhKcvHA5x/DoWzYanz7cjzPLbcC8yAxZNXsQ63oJLGR5BiM6bWFvCBzSTELV8G1JuByYW6BPgK6/769xKt4Dofbg6Xm6AT83GmC/1XBEp324bvgVDHsulLDlulARjS2gICHmvaoAE0w8NftYfGwUyiK7SLgRM9DkXBg5BTP5UBbSi0M93vIj7eImPq+RgGfnRZ7vQGBofrPwVOLXweuXN/fPAuh1HKByC8XySBGww1EACNdD2iVC+aFqCPfheZ/JSlYuqNTG50e3TlavIyzoKz7wMYIrjJcLfiwNCAubOar8jAj8LdckknCKMn579W2oIGEcV1moCoiohMaZCrjmm6pS/qnb5WH8/MxSo0S+9oM+DruwoP3EMVhe1Wz+7PWtii7jp4DqhXRjaHO5ujk4TUpHNa6ZVq+pRFFfq4PXuxJdeo= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW2PR0102MB3482.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39850400004)(376002)(136003)(346002)(396003)(478600001)(66946007)(66476007)(8676002)(8936002)(956004)(921005)(66556008)(52116002)(6506007)(2616005)(6512007)(5660300002)(86362001)(4326008)(38100700002)(1076003)(38350700002)(7416002)(316002)(83380400001)(186003)(6666004)(2906002)(110136005)(54906003)(6486002)(16526019)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: VAawtY7SzeMI7QhtbdIb09nw0D0d3Uces2E33FdmxdpbI08M/snAAOCFceL3qFVBp6rx44sIOVI8LIC+p4HF9fIpKoddetwnjYwNPbM1Pxs5AA1hcIzFC0g3J+ueRerPNNmTXmdf1B6Vwg1JWijf2GulwvrAFuK36JmsUf53g23DFRSuy2mnSx/oW24BpICLW59tWEYn5vWA5HXPkF1FEysf0VcPigkJ/hr096AbeabpslmEuvSlIpgUuUAuZeVSG2g7F76ZCZvV038nQEL2psK6hiHCQG7H2T17/PiEoMypQuscwbyzrx9kuHiMYqw6BIY62wFJPKzVycTQJo/t0i7ay+0ZhYCu5zG2P/nCXj0X+UqVGSPKZd34WUYgHCqM7Pwa9Zz8XGB2j5/1tKtmmkyxgbg5PjjLBC3oCvkV8m+FYDwQmMTQxnIFHKHZm9zo+/lUEiFBi5olCHX5cL72WKiJRPsw59o3VxqKP8JdzTU5cxCesetRTZvoOCLU3DF6swMJgQborpK67EWfGUK5IcxvkNK6fF5f1RVsF0EH1oh5o/+v9Z3P3fzxKdS9T6lwNxmtGqDSEFmTSBElaGvknxkBhcCgrdSAUccGSwtYwnOwomCCN2oqpzjfx6fXr89EAVg/ypx554tXbhOBhRHFMSlKGxfLclFglWC2NPL0JfLGGL9BU8yYKGyZhIDkURPuZbngjIaMfhR0GbqJt+TnTLC/mniVPC+7vPhbNQDGhOeDjR5VHtd9ddSc85QcoeFr2JdH4GXR5Q9NXdkGDQFRJH4YxN9y219dfz9/DsE7he4ajVYuP3c3KcNv/kBrKlXG/z1TTE3RTt9eQyaSafSP2ZkvrShI3TzIerQRIgG0Fm7T5JEm/idpTOONM1S5+eG2dBWxKOvK5G0tRVfrC9vyKjI+659SupeloJOFegCq9N+vAd+b31Ao8PieVW8WZpgrbkkOpxUpBBPfDCeMsWdv/q69kgNStk0AqvGCRu2Ddy8jGz6O5T7TUklZ2NoWe1mWVZDCAw/1OBpT4dJEde00gdx4nz7DK461lvL1ZOGgrQHTnsXhWtqiCtMuj6e1nJ3ACYfU0MiN35KsUa2B70Y08aQUEb8zXRT0FJX95aF528WSLoWBtxn+8OxoDQ2OhukbmQm3aAEYTrll2AzcHf8Jnx8ho4KYJ5zrCCDxVKjgUx097ZXf/+c61ss8aLeBCrmjmr5QS+i9JuLkGBOd+5JF4AFao6QOXwpdD8smaNhu3F8+CWDFIo+GaludA1CsRoxLsEp9ZoUyXeP7uxfNxUPDVaJCvUKTT/cyo/5gFO5SnTqUPuZwi1+1ctAVMQ81Nhld X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 27675c48-38e8-47a8-9dad-08d91a9acc76 X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2021 07:50:41.0955 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Er5F6RneK7Kw2/80WzW8+Ct8nFVih5PKQxO02Rg3dCDs+9ymYDnvdGU57hha5i2nGN5bELf7+HnX/oDO8WfxzvVvUU8b0wdUem00ytFJ14s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR01MB6743 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_005044_185819_49BD9BAB X-CRM114-Status: GOOD ( 18.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This commits adds SSIF BMC driver specifically for Aspeed AST2500 which commonly used as Board Management Controllers. Signed-off-by: Quan Nguyen --- v3: + Splited into separate commit [Corey, Joel] + Invoked aspeed-specific aspeed_set_slave_busy() when busy to address deadlock from Graeme and comment from Philipp + Combined two interrupts to mask/unmask together [Corey] drivers/char/ipmi/Kconfig | 11 +++++ drivers/char/ipmi/Makefile | 1 + drivers/char/ipmi/ssif_bmc_aspeed.c | 75 +++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 drivers/char/ipmi/ssif_bmc_aspeed.c diff --git a/drivers/char/ipmi/Kconfig b/drivers/char/ipmi/Kconfig index ad5c5161bcd6..45be57023577 100644 --- a/drivers/char/ipmi/Kconfig +++ b/drivers/char/ipmi/Kconfig @@ -144,6 +144,17 @@ config SSIF_IPMI_BMC The driver implements the BMC side of the SMBus system interface (SSIF). +config ASPEED_SSIF_IPMI_BMC + depends on ARCH_ASPEED || COMPILE_TEST + select SSIF_IPMI_BMC + tristate "Aspeed SSIF IPMI BMC driver" + help + Provides a driver for the SSIF IPMI interface found on + Aspeed AST2500 SoC. + + The driver implements the BMC side of the SMBus system + interface (SSIF), specific for Aspeed AST2500 SoC. + config IPMB_DEVICE_INTERFACE tristate 'IPMB Interface handler' depends on I2C diff --git a/drivers/char/ipmi/Makefile b/drivers/char/ipmi/Makefile index d04a214d74c4..05b993f7335b 100644 --- a/drivers/char/ipmi/Makefile +++ b/drivers/char/ipmi/Makefile @@ -28,3 +28,4 @@ obj-$(CONFIG_ASPEED_KCS_IPMI_BMC) += kcs_bmc_aspeed.o obj-$(CONFIG_NPCM7XX_KCS_IPMI_BMC) += kcs_bmc_npcm7xx.o obj-$(CONFIG_IPMB_DEVICE_INTERFACE) += ipmb_dev_int.o obj-$(CONFIG_SSIF_IPMI_BMC) += ssif_bmc.o +obj-$(CONFIG_ASPEED_SSIF_IPMI_BMC) += ssif_bmc_aspeed.o diff --git a/drivers/char/ipmi/ssif_bmc_aspeed.c b/drivers/char/ipmi/ssif_bmc_aspeed.c new file mode 100644 index 000000000000..019e51e16a7e --- /dev/null +++ b/drivers/char/ipmi/ssif_bmc_aspeed.c @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * The driver for BMC side of Aspeed SSIF interface + * Copyright (c) 2021, Ampere Computing LLC + */ + +#include +#include +#include +#include +#include + +#include "ssif_bmc.h" + +extern void aspeed_set_slave_busy(struct i2c_adapter *adap, bool busy); +static void aspeed_set_ssif_bmc_status(struct ssif_bmc_ctx *ssif_bmc, unsigned int status) +{ + if (status & SSIF_BMC_BUSY) + aspeed_set_slave_busy((struct i2c_adapter *)ssif_bmc->priv, true); + else if (status & SSIF_BMC_READY) + aspeed_set_slave_busy((struct i2c_adapter *)ssif_bmc->priv, false); +} + +static int ssif_bmc_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct ssif_bmc_ctx *ssif_bmc; + + ssif_bmc = ssif_bmc_alloc(client, 0); + if (IS_ERR(ssif_bmc)) + return PTR_ERR(ssif_bmc); + + ssif_bmc->priv = i2c_get_adapdata(client->adapter); + ssif_bmc->set_ssif_bmc_status = aspeed_set_ssif_bmc_status; + + return 0; +} + +static int ssif_bmc_remove(struct i2c_client *client) +{ + struct ssif_bmc_ctx *ssif_bmc = i2c_get_clientdata(client); + + i2c_slave_unregister(client); + misc_deregister(&ssif_bmc->miscdev); + + return 0; +} + +static const struct of_device_id ssif_bmc_match[] = { + { .compatible = "aspeed,ast2500-ssif-bmc" }, + { }, +}; + +static const struct i2c_device_id ssif_bmc_id[] = { + { DEVICE_NAME, 0 }, + { }, +}; + +MODULE_DEVICE_TABLE(i2c, ssif_bmc_id); + +static struct i2c_driver ssif_bmc_driver = { + .driver = { + .name = DEVICE_NAME, + .of_match_table = ssif_bmc_match, + }, + .probe = ssif_bmc_probe, + .remove = ssif_bmc_remove, + .id_table = ssif_bmc_id, +}; + +module_i2c_driver(ssif_bmc_driver); + +MODULE_AUTHOR("Chuong Tran "); +MODULE_AUTHOR("Quan Nguyen "); +MODULE_DESCRIPTION("Linux device driver of Aspeed BMC IPMI SSIF interface."); +MODULE_LICENSE("GPL v2"); From patchwork Wed May 19 07:49:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 12266589 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B182C43461 for ; Wed, 19 May 2021 07:54:42 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 F14D2613B6 for ; Wed, 19 May 2021 07:54:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F14D2613B6 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=os.amperecomputing.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cFl6WrTj9e27OpO627Cmw7gyBMIAOD4MifOx41TUfdQ=; b=f2AYYvHaAkt2hGmv/K+NTdAIF HmKkxcDptR3wOWsncktmuzkJIzK/ucStFN4COpwOIt/7kqM64BJRHEqZmgUB+OOZitHW5kVkyx7MB Th2nx5TY4DW0rCl1rr7CawiMkjXO71WaydbtBeTZvblhbX9Y45Dx4i6vgTKOszh5FCWUYcWtXY2NW nErZH2CfY6FRhHRE6Ej59H0cITxZthS/UZQ0nLFdWLRyHOGE243syqlmzFIAPWXiXIp/WoNBCDqyA dllcFn3uSl8dQsBeTTKHBFhWAIyiTzefUYOy6p9Xywo3++eVkkjULWpwVJhp8nQrHPFyiEySvAE4e fa5Xqgsyg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljH0l-003F55-TK; Wed, 19 May 2021 07:53:01 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyf-003ELS-VS for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 07:50:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=Glrb4vzD3wcH0QfrVaYtRQA6+zo8DwoaU589Hro23QA=; b=ymi5ZqAXrBzfFas0DGQx4fvfNH 7pMFOZKXiKXsFDV2qp1gOlCWwTuKT3HH91BtleOI7dNXL1UU/qh8Dx07w6943bjs0Ai5H3FF9oBFc leXrNyb1tcYMfJK9SJ/oLZyW9Z4MXO1MVPVOACYKOVkXE8nHjr9yZzoZcFhXZy/PAM89jGsBh5xEd OLc+Dq9nGmMfhcUxifCq8/TuNQ715DYCU/oOmr+C7BXiRKIxucpAGXAxEyau89YsPYi24HAfPqARR S/ZP4ZaWwa5+T6DiCY6rm2OexYLaOyeC5VMu1XWQXmwatyY0RZnQOTrcuPBegKpeOUUWz+ZelV0Dk JyA2TfFg==; Received: from mail-bn8nam08on2095.outbound.protection.outlook.com ([40.107.100.95] helo=NAM04-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyd-00FEfx-3v for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 07:50:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T+Fj0TSm13KXs8zLiO0Oa/WQp6il1j38hwEDRl+QkgqYU1ItJumDfRXT1ybWPjkmHUBdjRj/nerX2SKaL1xEl46FHs/fyebIY8Q44p3jx/Vk13Dp837vf9xBcSynkQtFyD3/7ByLU+Vem43rKCYbrgZ3/isvWupff7XST41nmdSO7y/xPt8zuwarb04D+x+nruy5yuL/ufAJPOc8DbQw3ph5Uu35Jhza4Dmcr7JOPzZMobJMcH4U3+IiLDwvNms+gwy3IHikfoZZFF1mH0KtpeZeR6I2tpEDEl4D8foGZa1d2brF6Cs6pJ1x+spPW0kAyjH+Ji+a7jFwlOnowSimiw== 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=Glrb4vzD3wcH0QfrVaYtRQA6+zo8DwoaU589Hro23QA=; b=ILmvNx7Ln5ul94bv7hWiE2IbEYi7ItBx6r1+udCvF4gdri9XGDg0BWWzDxxp+HOWdaV/1pb9brKhrXI3C/UQXLNqIeyVdcu1eJuaEOolKsrXVHFUoJTUnD0frtW+nBggG9Fzo9VdXiqPgvSS71xVa67SpZ8tQHBrlVOXib3fwZnWbVY5gaDRT67a0JVJLvrYPxdVm7OfpeWC/rcMDGBN//DijiJKprnqFiuzRIUNrcQM4Ht5GU998N6KdXbE+8T1FRDwS3BetF9OFJlVwFUjATwhcAFcXvgGJdKC+G8zmnx1FEvFO6ScrQL0i8POPL1ILGlyjWBO9QDQBUejh9KfPg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Glrb4vzD3wcH0QfrVaYtRQA6+zo8DwoaU589Hro23QA=; b=jAqiZb0s8aoYE/nmV7VQ+aXCnJEJw6fS38pEo8JcK2lqStqrYJZaX8jM0DWPoifYtOb0FdKtYKUWTJ3atl42hE7ZE7/81tkHSKPu+vtHjDiPXw4foNCmYpJ0en2ntHFGhxF/PckiXYhECloEZKgkCyK9AqiqbOsaSSvCWGpR/7k= Authentication-Results: acm.org; dkim=none (message not signed) header.d=none;acm.org; dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) by CO1PR01MB6743.prod.exchangelabs.com (2603:10b6:303:d5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.26; Wed, 19 May 2021 07:50:45 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503%5]) with mapi id 15.20.4129.032; Wed, 19 May 2021 07:50:45 +0000 From: Quan Nguyen To: Corey Minyard , Rob Herring , Joel Stanley , Andrew Jeffery , Brendan Higgins , Benjamin Herrenschmidt , Wolfram Sang , Philipp Zabel , openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org Cc: Open Source Submission , Phong Vo , "Thang Q . Nguyen" , openbmc@lists.ozlabs.org Subject: [PATCH v3 7/7] bindings: ipmi: Add binding for Aspeed SSIF BMC driver Date: Wed, 19 May 2021 14:49:34 +0700 Message-Id: <20210519074934.20712-8-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210519074934.20712-1-quan@os.amperecomputing.com> References: <20210519074934.20712-1-quan@os.amperecomputing.com> X-Originating-IP: [118.69.219.201] X-ClientProxiedBy: HK2PR04CA0081.apcprd04.prod.outlook.com (2603:1096:202:15::25) To MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from hcm-sw-17.amperecomputing.com (118.69.219.201) by HK2PR04CA0081.apcprd04.prod.outlook.com (2603:1096:202:15::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Wed, 19 May 2021 07:50:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e021bf21-8463-48f0-3ff5-08d91a9acef0 X-MS-TrafficTypeDiagnostic: CO1PR01MB6743: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GbwcvCL6UajBIHReFTw5Ob16SdgrVkWeVUpMqGoXeXSr3gjdqprtrvWveb2hi+0/mh4TPS8jVPqB0HgEwjN94fQkwd5JAiIS6EecxnhtnA0IY3hDB3DE/5wXWC8qukHR8mFw8ozFfVq+vVcTYnR3ghUr3Qr0bx32SxPmGlZpTWgekhQbGWyU3g837Id+nbDWC1mJzDbnu0O1st9n3tR7dtj9rClPx+QUozmBKXXwyZvmbfctJxAfjKTz2jVNHHz/pHIQN+Zgh/mzP5Ditz+BklMveXQNLIHUsxvj5+8HuI3LIy7qQdxKPOuOUelx8hOnVOnW0Y9xS5z+Jq0QToN/uw7pyppbsVZy0JY6N6e+pFq1afG3wivLEmP/OHVdvQL6WeJ7ipen25ewvQrM7hvwU5NGQmrNiCt9EvOJmTm69dtxVXHPMH0FQ0p7fze5Y866H7wPOnHLaA/hEroiUkuzxEmkjGfLFbSaemHWZPl5DY8uSo57IddGfF90HshhYWvfi5w36aGODlep9P9ElmiIlsE7qhe1OJNGXv6/d7hz9aAHSvj4x6mhuIayyxnbmYUWOwb4CrWgzULPxMzApOHKdQhdhhndBIQ68wU3VDLVVyfu3kZV5pbzhJCPh1EPHh4Vourecj6apVwLAT9tRjYHn7c8p1o3gQ7r4uEhgMAg7Fn/tDa8Dqp+9rXLnQLxFX3PtbM9pgEr+2H1Wc8cGPg2eHtB62B42SQby2h0u498bp8EiUlwTy+ZUonDT6g6rwuCQ6+I39I0vK2Eok9Mu0J3tNrKzs8pi0TXBSPngBuhKXw= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW2PR0102MB3482.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39850400004)(376002)(136003)(346002)(396003)(478600001)(66946007)(66476007)(8676002)(8936002)(956004)(921005)(66556008)(52116002)(6506007)(2616005)(966005)(6512007)(5660300002)(86362001)(4326008)(38100700002)(1076003)(38350700002)(7416002)(316002)(186003)(6666004)(2906002)(110136005)(54906003)(6486002)(16526019)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: SEbbo1zkv1IOWhRrWfK1Dc+Y7OtdgLlNitmFeBzjBoynVymUi1dtH55i4hVfzEOt3pwE0MDg++Nb0ol+tbWyjU/Vt0V6M/YLjiZ77/5cFz+h6Ur3mRCLPoiypdWEkkZwhPGRp5aomm24g9qd7VmjDBlozxNaxYESN5FuTjTsRLEm8CbQfGvsFso42bJu1hgfyZ2DtJlnn5tmamX+MV+hWGKFndMm5V9PUTaExnY6GkwBDeOn1TngXfExZy8gN2hocCxyFqqhe5Pjzcjnw9EsFMK6Ys/TrNKTgtFEEKGXIF7G8ZtYi1iCingVY83qVSnwg2oX6CHqASNB7LZ4r4AUH4c2T+yhiyYsNdCERvJWWt5F0cpXFS9lktdP54PPT+5nk6PQ6R103uz0H261RCpC8oW6q7OqB25cNUmOjvWxpkVNHhgv8glIQ/AokRlrTZlviMS3g+wOcHneauAHm1/kD6MfOaErp0hLYZCcjhQhjyKWPeE0F0nYZ0pX/DEzYkZx/Y+PxaEuXPheIEwq23DjiIGuCuZnSuVuIjGhQuFZY05h1F8kiR8x/L8IZCuHY7vdg1jdenj9PpDo9drNAJK2hpIJUR2h/yvFBUPZj10ep2lUMNY2vW0yVfsfeOXl84ylbY2q8FQoxksY8x5AAwcaCYcRBaZsX84ULP+1qsDms5pEnSTyaodUWj4O2wXnXTOFHqBGiUG5U2wxj4dEtnCnWbeD9VpTW0gRKx48afz19zzwvprFd1tcD66lGWITthRz4mgNjPcbX0J5XKQfhsIdsYbAmrRkxQdMN6F/m1lXKMSf7JgT76d/p/z0jj1myWVCGWzgiLJ/v1Oxc9S4JC9tUUeFFTe89Vmw37OWRsgWKW65ieWeRKRBiy9ITly06mkX0LNoRXNRgCHb2EJFtgI4fLzIdhNZ+d9RwYtEY+PEl+t1fxjEs/6mHTO4LoYwwSK9TCQFFl0Y4V/QexVtywUr2JFtn13akCOmGN9CoUKb3lx39PK7UrPG7ltl9qY8p73Fgr+HLM44VfGS4sZJ9uQvVJCwC4fKr8komV7F1SopKGHcdUVgYI6PWBfSLehSl35ONGUBAuy1NTZxFX68LL96YjZLRw+RJFq/yTCn0oBgZ7OVqz1HeMsN+xgBRHhSVAk48ws8KfwG/uJk7Uskt7KBwEMmW8ia0A3HWBB7aPfNJY4ySSOfEw5c/yX6abDXESvhRrcPy6eUB0kyRw5BLh2nHjmee4X8sxShbj3l7WL+pjbXJqvgwN4J+06Wsfi6vd3T2sCJHuT7gVvCP3u/yTk/QckGtNUpYqQBwVJ/b5acyaP16tnNZpXGargjHtxf6aek X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: e021bf21-8463-48f0-3ff5-08d91a9acef0 X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2021 07:50:45.4639 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1KjyS0ZFzK0oJnUTwZiWafvCw1sgaIq2XT5Jcd6/ZEFXx7QH61G8cUrLe7nUbfdNIs7kTo17xUEXr4PJfxYb7oTiFkmS0k4cCCMTlS+bMN4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR01MB6743 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_005047_181095_F346B0DD X-CRM114-Status: GOOD ( 11.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add device tree binding document for the Aspeed SSIF BMC driver. Signed-off-by: Quan Nguyen --- v3: + Switched to use DT schema format [Rob] .../bindings/ipmi/aspeed-ssif-bmc.yaml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Documentation/devicetree/bindings/ipmi/aspeed-ssif-bmc.yaml diff --git a/Documentation/devicetree/bindings/ipmi/aspeed-ssif-bmc.yaml b/Documentation/devicetree/bindings/ipmi/aspeed-ssif-bmc.yaml new file mode 100644 index 000000000000..8608041fbf7e --- /dev/null +++ b/Documentation/devicetree/bindings/ipmi/aspeed-ssif-bmc.yaml @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/ipmi/aspeed-ssif-bmc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Aspeed SSIF IPMI interface + +description: SSIF IPMI device bindings for Aspeed + +maintainers: + - Thang Nguyen + +properties: + compatible: + enum: + - aspeed,ast2500-ssif-bmc + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + ssif-bmc@10 { + compatible = "aspeed,ast2500-ssif-bmc"; + reg = <0x10>; + };