Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1724287pxj; Wed, 19 May 2021 12:22:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxamlEmIm4qAtlyEM9A1IAmiMJ/WCaqbu39I7f0lJK6q6e608uKvDNVgIQVmkOeckaOyPny X-Received: by 2002:a17:906:abcc:: with SMTP id kq12mr717931ejb.97.1621452163943; Wed, 19 May 2021 12:22:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1621452163; cv=pass; d=google.com; s=arc-20160816; b=AmnlqYIElgQ8R174D6ucZksuiy1DK1TJ/sP+/do2GM9vDWDMspi/jj3sZt0xoJXew0 jGyv/a33QodYpPsuyOxd/cjKocn+mjkChpwsImrA2uwbybGnZtZsq4UCVux/thVg7mRi vQRcQ1FmQvRREyZeJkM8VIlS/vszntAQ50myWqtw/h8JDkDA3M40N7eANUARhpdbWtdo wVW0xfwQ24iBVbjN2sXLHErZ28X2r/9O+i2jwrj/A63Uq5goXLDW7e1/DFQHO/aqx04n Ke3tesSS4mH/8s/bBMr/j8F3cIGLOw3h/Dp7diZn1Tl43XE+uApY3qgnCA53p2r3+64J TXtA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=72qcUnPpdP0uEVnitS/qqBhvFc0fw0fVzMWmHey7FGA=; b=dChJrtz0fx3mvzCplbwFzscEnyhVqf9c3xjzTfn7Ds/U6LdMRiicI6DR3t9ZAFviH2 U/8UZoM7yn/WYMDqBuGNp6epPHj4KXr6gBjJL7WMNgMjnjn/MX6A55GQGKQZcTmgHMSn O+lhcAmIFIw94KY5jV0It4SPEWzjYab/CpIuVnBXfiS/ljQODp8iLqysRYcv/DB//2hf KLkAvQ3sdkbuw8Vbf4rb7zvjijx1FxL009ZIgC+vJaO14v0QacHg+md2Pws/w/L0eGSn DzXN8OoYLBveKrrltGsUEDWg1SbngOhRndqJmJvpMHkPOZHb9xn7lwC1mq10+2Wp6Dlz ssJQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=TR51DahR; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u10si304692ejk.397.2021.05.19.12.22.16; Wed, 19 May 2021 12:22:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=TR51DahR; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243966AbhESHwP (ORCPT + 99 others); Wed, 19 May 2021 03:52:15 -0400 Received: from mail-bn8nam08on2090.outbound.protection.outlook.com ([40.107.100.90]:27072 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237741AbhESHwJ (ORCPT ); Wed, 19 May 2021 03:52:09 -0400 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> Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: =?us-ascii?Q?VAawtY7SzeMI7QhtbdIb09nw0D0d3Uces2E33FdmxdpbI08M/snAAOCFceL3?= =?us-ascii?Q?qFVBp6rx44sIOVI8LIC+p4HF9fIpKoddetwnjYwNPbM1Pxs5AA1hcIzFC0g3?= =?us-ascii?Q?J+ueRerPNNmTXmdf1B6Vwg1JWijf2GulwvrAFuK36JmsUf53g23DFRSuy2mn?= =?us-ascii?Q?Sx/oW24BpICLW59tWEYn5vWA5HXPkF1FEysf0VcPigkJ/hr096AbeabpslmE?= =?us-ascii?Q?uvSlIpgUuUAuZeVSG2g7F76ZCZvV038nQEL2psK6hiHCQG7H2T17/PiEoMyp?= =?us-ascii?Q?Quscwbyzrx9kuHiMYqw6BIY62wFJPKzVycTQJo/t0i7ay+0ZhYCu5zG2P/nC?= =?us-ascii?Q?Xj0X+UqVGSPKZd34WUYgHCqM7Pwa9Zz8XGB2j5/1tKtmmkyxgbg5PjjLBC3o?= =?us-ascii?Q?CvkV8m+FYDwQmMTQxnIFHKHZm9zo+/lUEiFBi5olCHX5cL72WKiJRPsw59o3?= =?us-ascii?Q?VxqKP8JdzT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-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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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"); -- 2.28.0