From patchwork Mon Jun 12 19:56:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 106797 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp110421vqr; Mon, 12 Jun 2023 13:16:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ63YaiHM4pYF3vQx7q6Of4uIe1Rt2ZQUtWtnf827jST0ptpV+QOi7cKbTM9j7QRSWMgBe8A X-Received: by 2002:a17:90a:eac6:b0:25b:acaf:2e3d with SMTP id ev6-20020a17090aeac600b0025bacaf2e3dmr7176999pjb.30.1686600961620; Mon, 12 Jun 2023 13:16:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686600961; cv=none; d=google.com; s=arc-20160816; b=xb9xMvi8cJxyowudQ6uTUW+idYyh3IZPYSqJweLoKvhhV2pGTbOWCyTBCEGOVU1WlY 0nE+BPbr7MBSRCfm45nEIAuZA0ltdlmJjrZFxglpEs4qbuy6+pjR9aa5xeBcB4TxOChC +Bb3ATzBfdH3uEKXsvhm/sq9AR+RQWhJWA2cVHIR4gOlHqWXNsfr1+TspceXXRHQF93Y 5B1SFeHBg8z5iTxda0lmXLDoH/u6BX1krb8AJtmrl80kJlQR/F5IMMuILU143WDp+bTO ETIs8cinZGo5IEQw0iYusfsYoHBcop0yfhZBH7OUcY0FfD6+RAQPC7a0i53Npct0us1z tdsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Qyn+EWnxFstxyTndS+aBZAkYcNiZRJK1wB+Dw0C3Hw8=; b=FnyM1k8gZfjtZUaF9r3uT3NhCLtV8ZLY02YSIFFluc1htx/Xc18pXkuWO951GZBZOp cUfjv3x1yEwihyzgDRXNp3YWK/ti3X9T0jogbIntTCz4E9s5Hiph3ANLaxV9GaFmb7nC bvFG2P7yY2YU6QtmZGS9NrTPS2mybQHm7RTJhTnpXX63SypHtpJt3UK2wzU4AguObU/M hruGXEQrPJYJ7iCcMXaG6Il9hVvERZxgeIyXuvL7iHLaQg1JyaDZERvuusnU7JtKAFjg I0cHvC6phBa9dU3OGlY1R57hcVOD/057V/Y2Ai7m1odK1DNyj8hh2XrstauHLCh4i7Ze fHAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=pHzRx3VJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i3-20020a17090ad34300b00259b2f52633si7416375pjx.166.2023.06.12.13.15.49; Mon, 12 Jun 2023 13:16:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=pHzRx3VJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237655AbjFLT6G (ORCPT + 99 others); Mon, 12 Jun 2023 15:58:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236848AbjFLT5U (ORCPT ); Mon, 12 Jun 2023 15:57:20 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D5ED10D3; Mon, 12 Jun 2023 12:57:19 -0700 (PDT) Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJpFrt024148; Mon, 12 Jun 2023 19:57:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=Qyn+EWnxFstxyTndS+aBZAkYcNiZRJK1wB+Dw0C3Hw8=; b=pHzRx3VJCQZmS0kJQYW1Vgxs23zCIKWmojxSjqkXhJcj28iwW3PYb+IYzhC5529fhx0l fVpRXp5f/bhtCJer3Rn2Bcr8tRIE+7dCLuzg6oz3SjC0Tm0/cuIXl/v2PaD7DMECBoHj iEfNXRjEGBIcl9w0DN+/9REMIXkCSUZiY21B8KHrUzXEVPE5sXvYCergsPH8UwOcFJGF hh/a9OE+UgDQVzHTNQw7a8SEkA8NZCrAZEWyJGaTEjraeISW++14hKESBACgcafuCZ1s uzt6ImIKNmsw7wbY2qWVdDdBDl3MzGhYWlo972033QBLqLvwT9xMMq5GfY9tvIPmc8cG WQ== Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r69vjg2vv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:00 +0000 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35CHUCtK014145; Mon, 12 Jun 2023 19:56:59 GMT Received: from smtprelay01.wdc07v.mail.ibm.com ([9.208.129.119]) by ppma05wdc.us.ibm.com (PPS) with ESMTPS id 3r4gt5cnbh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:56:59 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35CJuwZD23659248 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jun 2023 19:56:58 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3CFFE58063; Mon, 12 Jun 2023 19:56:58 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E9A3B58065; Mon, 12 Jun 2023 19:56:57 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.148.226]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Jun 2023 19:56:57 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, andrew@aj.id.au, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org Subject: [PATCH 01/14] fsi: Move fsi_slave structure definition to header Date: Mon, 12 Jun 2023 14:56:44 -0500 Message-Id: <20230612195657.245125-2-eajames@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230612195657.245125-1-eajames@linux.ibm.com> References: <20230612195657.245125-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: j0uiUZu_vbOupwON-4XgUomGCR4j8OuH X-Proofpoint-GUID: j0uiUZu_vbOupwON-4XgUomGCR4j8OuH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-12_14,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 clxscore=1015 mlxscore=0 adultscore=0 spamscore=0 suspectscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306120169 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768529290112306909?= X-GMAIL-MSGID: =?utf-8?q?1768529290112306909?= Some FSI drivers may have need of the slave definition, so move it to a header file. Also use one macro for obtaining a pointer to the fsi_master structure. Signed-off-by: Eddie James --- drivers/fsi/fsi-core.c | 24 ++++-------------------- drivers/fsi/fsi-master-aspeed.c | 2 +- drivers/fsi/fsi-master-ast-cf.c | 2 +- drivers/fsi/fsi-master-gpio.c | 2 +- drivers/fsi/fsi-master-hub.c | 2 +- drivers/fsi/fsi-master.h | 2 +- drivers/fsi/fsi-slave.h | 28 ++++++++++++++++++++++++++++ 7 files changed, 37 insertions(+), 25 deletions(-) create mode 100644 drivers/fsi/fsi-slave.h diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 0b927c9f4267..d591e68afd11 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -23,6 +23,10 @@ #include #include "fsi-master.h" +#include "fsi-slave.h" + +#define CREATE_TRACE_POINTS +#include #define FSI_SLAVE_CONF_NEXT_MASK GENMASK(31, 31) #define FSI_SLAVE_CONF_SLOTS_MASK GENMASK(23, 16) @@ -78,26 +82,6 @@ static const int engine_page_size = 0x400; static DEFINE_IDA(master_ida); -struct fsi_slave { - struct device dev; - struct fsi_master *master; - struct cdev cdev; - int cdev_idx; - int id; /* FSI address */ - int link; /* FSI link# */ - u32 cfam_id; - int chip_id; - uint32_t size; /* size of slave address space */ - u8 t_send_delay; - u8 t_echo_delay; -}; - -#define CREATE_TRACE_POINTS -#include - -#define to_fsi_master(d) container_of(d, struct fsi_master, dev) -#define to_fsi_slave(d) container_of(d, struct fsi_slave, dev) - static const int slave_retries = 2; static int discard_errors; diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index 7cec1772820d..437f87b4a6a3 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -376,7 +376,7 @@ static int aspeed_master_break(struct fsi_master *master, int link) static void aspeed_master_release(struct device *dev) { struct fsi_master_aspeed *aspeed = - to_fsi_master_aspeed(dev_to_fsi_master(dev)); + to_fsi_master_aspeed(to_fsi_master(dev)); kfree(aspeed); } diff --git a/drivers/fsi/fsi-master-ast-cf.c b/drivers/fsi/fsi-master-ast-cf.c index 5f608ef8b53c..6124978305eb 100644 --- a/drivers/fsi/fsi-master-ast-cf.c +++ b/drivers/fsi/fsi-master-ast-cf.c @@ -1190,7 +1190,7 @@ static int fsi_master_acf_gpio_release(void *data) static void fsi_master_acf_release(struct device *dev) { - struct fsi_master_acf *master = to_fsi_master_acf(dev_to_fsi_master(dev)); + struct fsi_master_acf *master = to_fsi_master_acf(to_fsi_master(dev)); /* Cleanup, stop coprocessor */ mutex_lock(&master->lock); diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c index 7d5f29b4b595..ed03da4f2447 100644 --- a/drivers/fsi/fsi-master-gpio.c +++ b/drivers/fsi/fsi-master-gpio.c @@ -761,7 +761,7 @@ static DEVICE_ATTR(external_mode, 0664, static void fsi_master_gpio_release(struct device *dev) { - struct fsi_master_gpio *master = to_fsi_master_gpio(dev_to_fsi_master(dev)); + struct fsi_master_gpio *master = to_fsi_master_gpio(to_fsi_master(dev)); of_node_put(dev_of_node(master->dev)); diff --git a/drivers/fsi/fsi-master-hub.c b/drivers/fsi/fsi-master-hub.c index 01f0a796111e..6d8b6e8854e5 100644 --- a/drivers/fsi/fsi-master-hub.c +++ b/drivers/fsi/fsi-master-hub.c @@ -105,7 +105,7 @@ static int hub_master_link_enable(struct fsi_master *master, int link, static void hub_master_release(struct device *dev) { - struct fsi_master_hub *hub = to_fsi_master_hub(dev_to_fsi_master(dev)); + struct fsi_master_hub *hub = to_fsi_master_hub(to_fsi_master(dev)); kfree(hub); } diff --git a/drivers/fsi/fsi-master.h b/drivers/fsi/fsi-master.h index 4762315a46ba..967622c1cabf 100644 --- a/drivers/fsi/fsi-master.h +++ b/drivers/fsi/fsi-master.h @@ -136,7 +136,7 @@ struct fsi_master { u8 t_send_delay, u8 t_echo_delay); }; -#define dev_to_fsi_master(d) container_of(d, struct fsi_master, dev) +#define to_fsi_master(d) container_of(d, struct fsi_master, dev) /** * fsi_master registration & lifetime: the fsi_master_register() and diff --git a/drivers/fsi/fsi-slave.h b/drivers/fsi/fsi-slave.h new file mode 100644 index 000000000000..1d63a585829d --- /dev/null +++ b/drivers/fsi/fsi-slave.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright (C) IBM Corporation 2023 */ + +#ifndef DRIVERS_FSI_SLAVE_H +#define DRIVERS_FSI_SLAVE_H + +#include +#include + +struct fsi_master; + +struct fsi_slave { + struct device dev; + struct fsi_master *master; + struct cdev cdev; + int cdev_idx; + int id; /* FSI address */ + int link; /* FSI link# */ + u32 cfam_id; + int chip_id; + uint32_t size; /* size of slave address space */ + u8 t_send_delay; + u8 t_echo_delay; +}; + +#define to_fsi_slave(d) container_of(d, struct fsi_slave, dev) + +#endif /* DRIVERS_FSI_SLAVE_H */ From patchwork Mon Jun 12 19:56:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 106789 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp101846vqr; Mon, 12 Jun 2023 13:00:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4jXqHA/0xCdrjYgEFD+agI9uy9e8aa/ss3eBORaFs9sMbZJklVhTQIr+fiIjR7I3bgEbhU X-Received: by 2002:aa7:c38a:0:b0:510:e790:48fe with SMTP id k10-20020aa7c38a000000b00510e79048femr5334850edq.6.1686600034728; Mon, 12 Jun 2023 13:00:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686600034; cv=none; d=google.com; s=arc-20160816; b=hz/Y3V8kZEGSuc5GyqPL/DUTYFZP5F+NoFc4zCJNfFhubsPX5PTIBqfbW5eoUg5jUg 7WnmcI1vpEZQnP3D5/Wxa+IOBFZWnV/3S1tGGG8L1gcR85T4ovh4jdB/AxTrAoBj+4Us vWQ/HkB/3yjXPMO3EsINuj8OdjxRWriQzF4pvBP4S4EOOKk/k7Tk3rpuAB5FWhrgWms3 1lw5tIeBblAy/yEDKOjAt2Y2o9hSoAmIyp9HyqdZQSmqgqYLHB27NihNLKmnG9356QD6 8gvDs+jWxzbQi8+XcuN54ytvmwKWMH8Dih731kfefJZ82qRzPO6fn8lgrgtVxPfntcSL Ak4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tlmEo/kVrmSoI+f5eQKxgmNkhnCo7i/A1GBB4psqyLY=; b=Ck1fNuldYKtMf0xIYElOSc5UYlOVY1gccbqlDCXsMrrYuiL3pqpe8LFqXttl2fF/+C bFAdfPQfksJbjyg2IUD1MhwRBZ5sJpjhmWK9ioilEsJws8RSN1WmR2k4uflt9FDE2e8G HNMma+wMVSSNlUUryTWUYtQTStBgb0Q0FWuc437I3hy7xqWw/fSaGkGgCGKnQZNKcE4U 7izM4AiXiLu8SwVHrAf0UMewbsl+FVgTFhY2UpB+gSWU9/qOzZuiTjNejwnOkUS9TMtE 1E5ZsXYzWk4X+LTJHUTUXfTHIM4NctBWV2BwTQGrnHKpEwOUesNxyET87EmABP9rz13P 0r7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=DLaBOLn0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z20-20020aa7cf94000000b005169f6f7f6bsi6181639edx.56.2023.06.12.13.00.08; Mon, 12 Jun 2023 13:00:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=DLaBOLn0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238277AbjFLT5f (ORCPT + 99 others); Mon, 12 Jun 2023 15:57:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231586AbjFLT5S (ORCPT ); Mon, 12 Jun 2023 15:57:18 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 441D310CE; Mon, 12 Jun 2023 12:57:17 -0700 (PDT) Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJkitR021431; Mon, 12 Jun 2023 19:57:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=tlmEo/kVrmSoI+f5eQKxgmNkhnCo7i/A1GBB4psqyLY=; b=DLaBOLn0EU2UqSjNssyoDM514KRUd1WFxYbQZp8E4yCXSPq26s3ZEyUoeSHfLD5WOEe9 g86lnKasOpDgHSIBlIkN8FK4+BUzMdCkrX4Utx9aMIRwUtFXhQSnK8qa+JGUUGsW/7z9 iimtqXcbr2s/7bR/csFTATVlcsxrqjUR8UyksvQ5ZdogoeF/RY6WhPsurMu0rvTaxHyQ Gzvnra0cvkZSTAaU4nO1MIhGRUsMPJww0Fv3UCHoUFNRf4Xiufyp8gHd07YILW4fH99R RuyoXkr3ZKW8sJyAv9mI76crN/YpdzRI0bjOogz6j3PckSnkZduCphURQRdkLV9nfuO0 aw== Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r69tqg6af-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:00 +0000 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35CHjMA8002823; Mon, 12 Jun 2023 19:57:00 GMT Received: from smtprelay01.wdc07v.mail.ibm.com ([9.208.129.119]) by ppma03wdc.us.ibm.com (PPS) with ESMTPS id 3r4gt5cm95-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:56:59 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35CJuwhC20382182 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jun 2023 19:56:59 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 987D858059; Mon, 12 Jun 2023 19:56:58 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4647458043; Mon, 12 Jun 2023 19:56:58 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.148.226]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Jun 2023 19:56:58 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, andrew@aj.id.au, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org Subject: [PATCH 02/14] fsi: Add aliased device numbering Date: Mon, 12 Jun 2023 14:56:45 -0500 Message-Id: <20230612195657.245125-3-eajames@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230612195657.245125-1-eajames@linux.ibm.com> References: <20230612195657.245125-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 86MVaul5xD8OlY_TYUOyItXfR7hLhC8W X-Proofpoint-ORIG-GUID: 86MVaul5xD8OlY_TYUOyItXfR7hLhC8W X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-12_14,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=999 clxscore=1015 mlxscore=0 spamscore=0 suspectscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306120169 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768528317679480393?= X-GMAIL-MSGID: =?utf-8?q?1768528317679480393?= The I2C and SPI subsystems can use an aliased name to number the device. Add similar support to the FSI subsystem for any device type. Signed-off-by: Eddie James --- drivers/fsi/fsi-core.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index d591e68afd11..b77013b9d8a7 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -955,9 +955,34 @@ static int __fsi_get_new_minor(struct fsi_slave *slave, enum fsi_dev_type type, return 0; } +static const char *const fsi_dev_type_names[] = { + "cfam", + "sbefifo", + "scom", + "occ", +}; + int fsi_get_new_minor(struct fsi_device *fdev, enum fsi_dev_type type, dev_t *out_dev, int *out_index) { + if (fdev->dev.of_node) { + int aid = of_alias_get_id(fdev->dev.of_node, fsi_dev_type_names[type]); + + if (aid >= 0) { + int id = (aid << 4) | type; + + id = ida_simple_get(&fsi_minor_ida, id, id + 1, GFP_KERNEL); + if (id >= 0) { + *out_index = aid; + *out_dev = fsi_base_dev + id; + return 0; + } + + if (id != -ENOSPC) + return id; + } + } + return __fsi_get_new_minor(fdev->slave, type, out_dev, out_index); } EXPORT_SYMBOL_GPL(fsi_get_new_minor); From patchwork Mon Jun 12 19:56:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 106801 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp111601vqr; Mon, 12 Jun 2023 13:18:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6nXJiXxdMfX6AUdBPqhvEF64XkgxF+9CQ250rwPCP3BmiVOxfbcvXcLWLmYIcQX7uuLvfx X-Received: by 2002:a05:6a00:1703:b0:664:9579:d303 with SMTP id h3-20020a056a00170300b006649579d303mr9222328pfc.4.1686601109949; Mon, 12 Jun 2023 13:18:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686601109; cv=none; d=google.com; s=arc-20160816; b=d6Uut34L7kbVZE8DGtHH40sES3Zj3KVPmnNqzS1vZcraaD1C1uzUPMwRLVBwal3bu1 2QJ9ZqwCpZMb7LZS66nHvfnTisXuRSkCNY84+pc54e6fzW3ehBPghI8591ppJI2dwkw/ Z5be8fAEg1BhMYXSJuz16M/thY51IwnfudIrHfphI02XUpuU6kR3rFgfHGQYxWQufyl0 Tx3hh7j5UQPuLg/ufVNvrHz1HMtYJzYJpe9omIKZVqtmDXKnMZvMLIjaprABfb8lPVEN tpC5vEcT1JPPMKjYh85OnBEHF/tg2HmL2usChbUSL/mIo3A++8DCrZYSi7yef3QaKCEa rZcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=s4kIBTdwHgvnp0JR5GqHrVoFL9IUarVdZp5dipeTXo0=; b=qQ7gwg/cUGQIfK7ZjC6Xe7dChRa3dvmzin1T7Gl5E2A0wziqXnViyaABh3ZbAIHqi7 QBh0ne8xBp6/MgUuGjLXLFvfIua8kGVYXbirQumxK8MDvTgqO9XeFECzEaroSgDn04/D RAiFbam6kkqleCJJvMBPMggej4q2UVeAzoS5S+GH0cDGBitC6Fgo0YV56PztfUj5FDkB sbzrhJPT0LsI0VUo6GJX1Itmv9mPmz4atSnKILo3wGWO8Nxi+ZQq6dfqzMwouqJFVpSR JLKIqr06WeUS1LxRF5jR2j6d41pkkD/8wxmLcdWiM5b+wsfFCGESjXpY447tFJ56906z D7wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=QcxriQNE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z2-20020aa79e42000000b0065b0945f1c7si7236602pfq.272.2023.06.12.13.18.17; Mon, 12 Jun 2023 13:18:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=QcxriQNE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237876AbjFLT5r (ORCPT + 99 others); Mon, 12 Jun 2023 15:57:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233576AbjFLT5T (ORCPT ); Mon, 12 Jun 2023 15:57:19 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1DA810FA; Mon, 12 Jun 2023 12:57:17 -0700 (PDT) Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJkapc007067; Mon, 12 Jun 2023 19:57:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=s4kIBTdwHgvnp0JR5GqHrVoFL9IUarVdZp5dipeTXo0=; b=QcxriQNEJFNJojJQXXTfITP272HFv9qme9SHdHw/uvTVdffDWctxRE4fARDoGd4ezsNP nPyInwI4109DkGJ7qOb4YJeXMI6qj7zQo3mUt9eTAbU3e/W5u5tUOex6vaGRGFRqG+xz bvMh85edSJ1IOaI4FQfI+MX+0l+ud4kSv7MyG97eB3sx4LT0Raji1ZBv95I2c+6j4mjq Of7+1iR2VliPecG2HbrwO6OMhQwdOla8llZnH4LM+aOVrp3zKgIyAHbrXGJkvsq4aYff nqqMj9oZC8jNlCcQrf81vc7TNtiuSA1P59YizJApvaWX5d//SKD22nzAll0BZ3L5mWGg 9Q== Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r69tpg6hw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:01 +0000 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJ6r5V027203; Mon, 12 Jun 2023 19:57:00 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([9.208.129.120]) by ppma02dal.us.ibm.com (PPS) with ESMTPS id 3r4gt5krqy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:00 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35CJuxYp3080800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jun 2023 19:56:59 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E8B1658043; Mon, 12 Jun 2023 19:56:58 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A27A05805D; Mon, 12 Jun 2023 19:56:58 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.148.226]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Jun 2023 19:56:58 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, andrew@aj.id.au, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org Subject: [PATCH 03/14] fsi: Use of_match_table for bus matching if specified Date: Mon, 12 Jun 2023 14:56:46 -0500 Message-Id: <20230612195657.245125-4-eajames@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230612195657.245125-1-eajames@linux.ibm.com> References: <20230612195657.245125-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Ubf8GxZQJWqSeM0zJoUGdy9sBzTBDGPL X-Proofpoint-ORIG-GUID: Ubf8GxZQJWqSeM0zJoUGdy9sBzTBDGPL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-12_14,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 mlxscore=0 malwarescore=0 spamscore=0 phishscore=0 impostorscore=0 clxscore=1015 adultscore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306120169 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768529445130907396?= X-GMAIL-MSGID: =?utf-8?q?1768529445130907396?= Since we have two scom drivers, use the standard of matching if the driver specifies a table so that the right devices go to the right driver. Signed-off-by: Eddie James --- drivers/fsi/fsi-core.c | 11 +++++++++-- drivers/fsi/fsi-scom.c | 8 ++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index b77013b9d8a7..ca4a9634fbc3 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -1375,8 +1376,14 @@ static int fsi_bus_match(struct device *dev, struct device_driver *drv) if (id->engine_type != fsi_dev->engine_type) continue; if (id->version == FSI_VERSION_ANY || - id->version == fsi_dev->version) - return 1; + id->version == fsi_dev->version) { + if (drv->of_match_table) { + if (of_driver_match_device(dev, drv)) + return 1; + } else { + return 1; + } + } } return 0; diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c index bcb756dc9866..61dbda9dbe2b 100644 --- a/drivers/fsi/fsi-scom.c +++ b/drivers/fsi/fsi-scom.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -587,6 +588,12 @@ static int scom_remove(struct device *dev) return 0; } +static const struct of_device_id scom_of_ids[] = { + { .compatible = "ibm,fsi2pib" }, + { } +}; +MODULE_DEVICE_TABLE(of, scom_of_ids); + static const struct fsi_device_id scom_ids[] = { { .engine_type = FSI_ENGID_SCOM, @@ -600,6 +607,7 @@ static struct fsi_driver scom_drv = { .drv = { .name = "scom", .bus = &fsi_bus_type, + .of_match_table = scom_of_ids, .probe = scom_probe, .remove = scom_remove, } From patchwork Mon Jun 12 19:56:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 106798 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp110721vqr; Mon, 12 Jun 2023 13:16:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4nz3LRmsHOw3poIkMRA9X11H4m3yaMoq0amsuiBbgHiZWE3hiyEPb8ftwEkrl5YZkVjuUO X-Received: by 2002:a17:902:e842:b0:1b2:436b:931c with SMTP id t2-20020a170902e84200b001b2436b931cmr8875897plg.43.1686601003901; Mon, 12 Jun 2023 13:16:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686601003; cv=none; d=google.com; s=arc-20160816; b=GoEcMcsIoohpOjnGVzaTIz7+nczc6fTuIp4SQ/eN2pHG1zAEsGYP1jgZ338YZeQu2U ceokVHxmkfp3PfU8pPZyss/JoIKP0xjFW0zdLGTpJy9GuiKKJ/L7Xnyi9cNN/9uOd/Wo R6zBfYeNXhmkZVLNc7waW38XCLivY99GDQtqT4RVpsEkOPlXd5tHBFaRKOXLr5hVjmk5 83NJvVAIY8pZAN/QhoK/sESZaJuZYUkyPEmEdiaA5wMV2VdGTN88H1sYE8TgmelHQRfs V3/+Pdx+DZnr/3wHxg2YdnOD0OmhchduRuEgH1QGvLUnjQ8i26pJ5VmhDJHRXggzkoM+ Z7Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KJc0ydFTUgIwjCtrGuXVj0xPsA/uMLi0FjiGPI0kMbA=; b=baUnzdeJ/k5eFR/cFFAZFNyDU3hIo7EJFxQFC8FQxU7gcromnbA8zm7kuPmW7eHAnQ VfyuvPjS8v3EkbJNcEsZ/LqBSdiARiF9QQSaIP5AYAXi48UPIk9V+Q86OyVE1ESTHbdz ZnEo6DZHMOKma52wsGeKdAmwqcZ/XHUSpNbspET/jLcGGooKlxxZdB+W4KshXwKmwh+Y un7McTwPCbjIuv8JiOnawF0EywbVXAVJgaBUKVUBUfFSjrhI5DB0246WftoYuljuH9+6 skaxKCcYU9KfBoF1HOM+EaKJZeWOGD7yHWdiaQO5AZS+cLZZdI5vA8h1iU3RXbrmNLZi KrRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Tfl4LEx5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a170902ecc700b001b184b4bb75si7699097plh.381.2023.06.12.13.16.31; Mon, 12 Jun 2023 13:16:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Tfl4LEx5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237901AbjFLT5X (ORCPT + 99 others); Mon, 12 Jun 2023 15:57:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230335AbjFLT5S (ORCPT ); Mon, 12 Jun 2023 15:57:18 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 843CEE73; Mon, 12 Jun 2023 12:57:16 -0700 (PDT) Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJohBC008964; Mon, 12 Jun 2023 19:57:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=KJc0ydFTUgIwjCtrGuXVj0xPsA/uMLi0FjiGPI0kMbA=; b=Tfl4LEx5WJPFrF8v3RmsR0L7Ibdu6uybHsxlWvkc0aKGApOX4iKVIjfqO41qtfd0gUCX g3heRBuyohwyUCQkiyTEnnK9jQ40p5zlR4B0tapHImtgTltK6wxpO5/FvhzgGW/MVaBI s4crqgJyD/DNeu2hZoRJAk6RFx9vvC0t5bkLjp0UDZjq0PRJ6s2cw0CAwfVfZRFKRwWa 0XLqLsjvlMWysibeHIU+v/Hg5l1Gufr7gY3fZyEWf15MT17jiZ82XTrufv7HfdK1Zb3m gxDkAwOoBIXeL7+infxifiDJ7duK8Z0LINv12wGks3i7DJwISxjRkmF9umjA1WHB8029 3g== Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r69vjr4a0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:02 +0000 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35CHmAC3014264; Mon, 12 Jun 2023 19:57:00 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([9.208.129.120]) by ppma05wdc.us.ibm.com (PPS) with ESMTPS id 3r4gt5cnbm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:00 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35CJuxkW65077646 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jun 2023 19:56:59 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4CF0958059; Mon, 12 Jun 2023 19:56:59 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F1D5258055; Mon, 12 Jun 2023 19:56:58 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.148.226]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Jun 2023 19:56:58 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, andrew@aj.id.au, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org Subject: [PATCH 04/14] fsi: sbefifo: Don't check status during probe Date: Mon, 12 Jun 2023 14:56:47 -0500 Message-Id: <20230612195657.245125-5-eajames@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230612195657.245125-1-eajames@linux.ibm.com> References: <20230612195657.245125-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 4lxnktf1tHCr6ncAOsF_YqNDseKc0u0D X-Proofpoint-ORIG-GUID: 4lxnktf1tHCr6ncAOsF_YqNDseKc0u0D X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-12_14,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 mlxscore=0 malwarescore=0 bulkscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 clxscore=1015 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306120169 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768529334159021209?= X-GMAIL-MSGID: =?utf-8?q?1768529334159021209?= The status check during probe doesn't serve any purpose. Any attempt to use the SBEFIFO will result in the same check and cleanup. Signed-off-by: Eddie James --- drivers/fsi/fsi-sbefifo.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c index 9912b7a6a4b9..42d7c95528d1 100644 --- a/drivers/fsi/fsi-sbefifo.c +++ b/drivers/fsi/fsi-sbefifo.c @@ -1027,14 +1027,6 @@ static int sbefifo_probe(struct device *dev) mutex_init(&sbefifo->lock); sbefifo->timeout_start_rsp_ms = SBEFIFO_TIMEOUT_START_RSP; - /* - * Try cleaning up the FIFO. If this fails, we still register the - * driver and will try cleaning things up again on the next access. - */ - rc = sbefifo_cleanup_hw(sbefifo); - if (rc && rc != -ESHUTDOWN) - dev_err(dev, "Initial HW cleanup failed, will retry later\n"); - /* Create chardev for userspace access */ sbefifo->dev.type = &fsi_cdev_type; sbefifo->dev.parent = dev; From patchwork Mon Jun 12 19:56:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 106799 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp111075vqr; Mon, 12 Jun 2023 13:17:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4dt9qHhs5g1VFKkEB7lqvnjCZGk5jVdgW0ORvTQ3MubuaWcQGxQ8bIBGc0WVN39Tx0Jj5r X-Received: by 2002:a05:6a20:382:b0:10f:130c:53e4 with SMTP id 2-20020a056a20038200b0010f130c53e4mr7959438pzt.41.1686601045699; Mon, 12 Jun 2023 13:17:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686601045; cv=none; d=google.com; s=arc-20160816; b=CYLFa6k3anAFUFcr/857oEehI+FuE4MM4b0c9G3V/psT3TM+/P3Qln52X45i+viaji +XAHsbuehTjqaKJtTPyo8zImVmrBqtoXGxp4GzpeRjGQ7V0hqd/4Skcp6Js5oPoyeFVL S8sieqo6AdateyWQc0lEDin5T3MzOtc4rhYY88KJfQw50CrMzAIN4omShsUdRrjB/LwA iW+EpPPAS1s+0UtKbCZcl3jfU1GZxtjxJjMKJ6Uhk8i929fARcmtP65U/pvy3eU2arjC ZQ8yOt9j6+DETBuKVLvKMIgmDdZPr6GBnngtXYcoh1KJt4ofqn+gMPOamvAtl+AiEd4G hYsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cX6XRVZYcRIiEIAah+ZhS1yVvJ/XcMDdbd7xxssaCTg=; b=YkzbFF2c167Yl0pkyQb0DB3LpxSMphnciynJaGk7NwvEiVH78TbiXR+m5kWcR5bHv1 CId7DYTxFXMR32FpyZKLeV5KQc3bp+e1uMHMfFloGSBrUvZ8YNX+GFhSCmzB8DYDYT0F D0xmf62Gei9fIuaJBancFq40ahrER1yUeLTwbs5AfKX8jzZmyAF2SwDjwxQ8WPFtP5y3 X2rVYr874q9WNfgCRgfyXMaSlsAlRmqiovzSry7r52S1IVkManVy+hX7B73M5B2uLW1c NzSZdS4ClDLU0MsetfFOdl6NVPR1uYW+xZsRhpAIfFmCQSPh9jjhMTqt4M8pLTMUzOsr SqtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=JRIo2bq5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k25-20020aa79739000000b006434e20d01asi5438508pfg.199.2023.06.12.13.17.13; Mon, 12 Jun 2023 13:17:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=JRIo2bq5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238257AbjFLT5i (ORCPT + 99 others); Mon, 12 Jun 2023 15:57:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232633AbjFLT5T (ORCPT ); Mon, 12 Jun 2023 15:57:19 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8478810F5; Mon, 12 Jun 2023 12:57:17 -0700 (PDT) Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJg1x7011634; Mon, 12 Jun 2023 19:57:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=cX6XRVZYcRIiEIAah+ZhS1yVvJ/XcMDdbd7xxssaCTg=; b=JRIo2bq5tp7VRwFZjdEq0G+hpHfXhvUuUxU1rirC8/bh6bMcF9dlDLBtfFSPrtyaCELj hMDzYk1tgyxFM6H0bmIj5ggUz42Vj/tc5dVMRTMBu82wF5+B9scwxQVFlYyq5XnZqdO9 bRik7yk9KSB/aSALfMUKBT7h9rkpThhiiztDpBqPsLhXHWrZOr6q9l71mkKwol4NyiPH vcUp9OKZVbTN4EkgyEdFxc/QzHDzzux9HfxjZUZoFMUjqeABka7ar6+riYRc/ibqzD6U zQjZ7jYQdWUWdQXVN7/1rrc/QNdW1rlMp1xqfHa9er650XN4FaKH86Nugz/yc7O6rRhb eQ== Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r69r8rc4b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:02 +0000 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35CBf2cO020557; Mon, 12 Jun 2023 19:57:01 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([9.208.129.120]) by ppma03dal.us.ibm.com (PPS) with ESMTPS id 3r4gt4uu9u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:01 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35CJuxUq1311294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jun 2023 19:57:00 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A34F258055; Mon, 12 Jun 2023 19:56:59 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 56D985805D; Mon, 12 Jun 2023 19:56:59 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.148.226]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Jun 2023 19:56:59 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, andrew@aj.id.au, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org Subject: [PATCH 05/14] fsi: sbefifo: Add configurable in-command timeout Date: Mon, 12 Jun 2023 14:56:48 -0500 Message-Id: <20230612195657.245125-6-eajames@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230612195657.245125-1-eajames@linux.ibm.com> References: <20230612195657.245125-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: JI9EFeUV82SVUzsy_E6p2Ykp0uigrQiM X-Proofpoint-ORIG-GUID: JI9EFeUV82SVUzsy_E6p2Ykp0uigrQiM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-12_14,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=999 priorityscore=1501 suspectscore=0 clxscore=1015 bulkscore=0 adultscore=0 spamscore=0 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306120169 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768529377923509509?= X-GMAIL-MSGID: =?utf-8?q?1768529377923509509?= From: Eddie James A new use case for the SBEFIFO requires a long in-command timeout as the SBE processes each part of the command before clearing the upstream FIFO for the next part of the command. Signed-off-by: Eddie James --- drivers/fsi/fsi-sbefifo.c | 30 +++++++++++++++++++++++++++++- include/uapi/linux/fsi.h | 10 ++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c index 42d7c95528d1..5e6a9e08a92d 100644 --- a/drivers/fsi/fsi-sbefifo.c +++ b/drivers/fsi/fsi-sbefifo.c @@ -127,6 +127,7 @@ struct sbefifo { bool dead; bool async_ffdc; bool timed_out; + u32 timeout_in_cmd_ms; u32 timeout_start_rsp_ms; }; @@ -136,6 +137,7 @@ struct sbefifo_user { void *cmd_page; void *pending_cmd; size_t pending_len; + u32 cmd_timeout_ms; u32 read_timeout_ms; }; @@ -508,7 +510,7 @@ static int sbefifo_send_command(struct sbefifo *sbefifo, rc = sbefifo_wait(sbefifo, true, &status, timeout); if (rc < 0) return rc; - timeout = msecs_to_jiffies(SBEFIFO_TIMEOUT_IN_CMD); + timeout = msecs_to_jiffies(sbefifo->timeout_in_cmd_ms); vacant = sbefifo_vacant(status); len = chunk = min(vacant, remaining); @@ -802,6 +804,7 @@ static int sbefifo_user_open(struct inode *inode, struct file *file) return -ENOMEM; } mutex_init(&user->file_lock); + user->cmd_timeout_ms = SBEFIFO_TIMEOUT_IN_CMD; user->read_timeout_ms = SBEFIFO_TIMEOUT_START_RSP; return 0; @@ -845,9 +848,11 @@ static ssize_t sbefifo_user_read(struct file *file, char __user *buf, rc = mutex_lock_interruptible(&sbefifo->lock); if (rc) goto bail; + sbefifo->timeout_in_cmd_ms = user->cmd_timeout_ms; sbefifo->timeout_start_rsp_ms = user->read_timeout_ms; rc = __sbefifo_submit(sbefifo, user->pending_cmd, cmd_len, &resp_iter); sbefifo->timeout_start_rsp_ms = SBEFIFO_TIMEOUT_START_RSP; + sbefifo->timeout_in_cmd_ms = SBEFIFO_TIMEOUT_IN_CMD; mutex_unlock(&sbefifo->lock); if (rc < 0) goto bail; @@ -937,6 +942,25 @@ static int sbefifo_user_release(struct inode *inode, struct file *file) return 0; } +static int sbefifo_cmd_timeout(struct sbefifo_user *user, void __user *argp) +{ + struct device *dev = &user->sbefifo->dev; + u32 timeout; + + if (get_user(timeout, (__u32 __user *)argp)) + return -EFAULT; + + if (timeout == 0) { + user->cmd_timeout_ms = SBEFIFO_TIMEOUT_IN_CMD; + dev_dbg(dev, "Command timeout reset to %us\n", user->cmd_timeout_ms / 1000); + return 0; + } + + user->cmd_timeout_ms = timeout * 1000; /* user timeout is in sec */ + dev_dbg(dev, "Command timeout set to %us\n", timeout); + return 0; +} + static int sbefifo_read_timeout(struct sbefifo_user *user, void __user *argp) { struct device *dev = &user->sbefifo->dev; @@ -971,6 +995,9 @@ static long sbefifo_user_ioctl(struct file *file, unsigned int cmd, unsigned lon mutex_lock(&user->file_lock); switch (cmd) { + case FSI_SBEFIFO_CMD_TIMEOUT_SECONDS: + rc = sbefifo_cmd_timeout(user, (void __user *)arg); + break; case FSI_SBEFIFO_READ_TIMEOUT_SECONDS: rc = sbefifo_read_timeout(user, (void __user *)arg); break; @@ -1025,6 +1052,7 @@ static int sbefifo_probe(struct device *dev) sbefifo->fsi_dev = fsi_dev; dev_set_drvdata(dev, sbefifo); mutex_init(&sbefifo->lock); + sbefifo->timeout_in_cmd_ms = SBEFIFO_TIMEOUT_IN_CMD; sbefifo->timeout_start_rsp_ms = SBEFIFO_TIMEOUT_START_RSP; /* Create chardev for userspace access */ diff --git a/include/uapi/linux/fsi.h b/include/uapi/linux/fsi.h index b2f1977378c7..a2e730fc6309 100644 --- a/include/uapi/linux/fsi.h +++ b/include/uapi/linux/fsi.h @@ -59,6 +59,16 @@ struct scom_access { * /dev/sbefifo* ioctl interface */ +/** + * FSI_SBEFIFO_CMD_TIMEOUT sets the timeout for writing data to the SBEFIFO. + * + * The command timeout is specified in seconds. The minimum value of command + * timeout is 1 seconds (default) and the maximum value of command timeout is + * 120 seconds. A command timeout of 0 will reset the value to the default of + * 1 seconds. + */ +#define FSI_SBEFIFO_CMD_TIMEOUT_SECONDS _IOW('s', 0x01, __u32) + /** * FSI_SBEFIFO_READ_TIMEOUT sets the read timeout for response from SBE. * From patchwork Mon Jun 12 19:56:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 106800 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp111203vqr; Mon, 12 Jun 2023 13:17:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Zhkl9SOiyaybfXVOdoRHGAlEgMXslL5AV9hM6roVyEqYJIJzhrLOr0hO+da6ZHZbgHcfl X-Received: by 2002:a05:6a20:1594:b0:111:346c:3480 with SMTP id h20-20020a056a20159400b00111346c3480mr12760745pzj.44.1686601061625; Mon, 12 Jun 2023 13:17:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686601061; cv=none; d=google.com; s=arc-20160816; b=gnRbnClVO6CvukCUIyw0oOX9FhvdBN2DPPavbY63Asj/E2ytb15tAuuB1CCE9OAciv iFgBPHIep1uxpe1lARAUZyyQcLHOH96uGED1QL44RtOUu5QqVwjr5y03utSenXnshCWN E0fRWkGdSYN2NF5bzmVr7gqh49Apl4CK1Q5AXy5yVn3MXDew4W8KG0ITF+YKgC632h4R OO7M2mjz+EPXr/AXz6trFkhoisEtpS7U0wHcJ0YgaM/xZ6ClKUwcg9m9VDbwh4uDhtTR aM7ZfBUzUQpNjzeQX7hyMQ/f25KX1KSW+hseV+GfWszqyMtR+MGLQrBmr2TumqM3VxaD 1ndQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yTuOPuTIZ5qIjR61b/ip9h6OGHcqoNr3zzAKHdVxDxM=; b=vqqBxyOwUFzKfY3CqmskUBkLk4HyE4p/GjFFdjaM80GiKGHN9CwMnuaf29x+FIDMeP 7lcI2FVNNR6eANUX1HGjBYeWLi35CciVRQZUZOfrj+T76PCYg69pS1ily7y5XXssUeWc jczoUvf0BVR9CsQXFWurPU/v/xotuVPP847Yz/Jc1Xiihqu34fGrFoR9y21DG3tc/qfN ab9fHy0jTr21ayu5T+qkpNzHu0ky02gX+FOUnspdPm1QKovFa0CGqGHKdPYn3wJMAFAi k5ozIo9GNmEwUnKWYpp4CG1zKWtWCmTQ5CZMQZNz99b4VhDm8A1NugcI/AAsveGSzmeQ NgNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Ir12TBec; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c19-20020aa79533000000b0063b7acc199bsi7326614pfp.65.2023.06.12.13.17.28; Mon, 12 Jun 2023 13:17:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Ir12TBec; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235498AbjFLT5U (ORCPT + 99 others); Mon, 12 Jun 2023 15:57:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229836AbjFLT5S (ORCPT ); Mon, 12 Jun 2023 15:57:18 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3230CE77; Mon, 12 Jun 2023 12:57:17 -0700 (PDT) Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJkhSb021406; Mon, 12 Jun 2023 19:57:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=yTuOPuTIZ5qIjR61b/ip9h6OGHcqoNr3zzAKHdVxDxM=; b=Ir12TBecTzzfQqD/et7w3taF7TfpA78dzOf02YEhECGouNw/oVMa4Bb2aldbc5fFdA9f HkcriGwZpwraf0z5fguu7YN2m+kB89ZF+xd0iPe5Y/CtTloSyc9E/xOy7BWDnH9drqx4 WjdsqM43HRrTMvtClL8BJrrYFji1/vWHRiZeUMfZ/jnfTBQHibG1AB32hiKuLG2y3pP+ vgsCMiQjWr0MLvL+ngRsy8S6cpdPDCBuqUlReVZk0/USAXAACvvFBVJW1xXXSjklPSRJ OKx8sHgjKoiNOXVRXptuOZgAtH6jC/9NRDW/Uz9wLoeVos23r//UVxDapTwV4HgEEUHb 1A== Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r69tqg6as-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:01 +0000 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35CHNIis014554; Mon, 12 Jun 2023 19:57:00 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([9.208.130.97]) by ppma02wdc.us.ibm.com (PPS) with ESMTPS id 3r4gt5cnrg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:00 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35CJv0di28574342 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jun 2023 19:57:00 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 080FC58059; Mon, 12 Jun 2023 19:57:00 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AD48E5805E; Mon, 12 Jun 2023 19:56:59 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.148.226]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Jun 2023 19:56:59 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, andrew@aj.id.au, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org Subject: [PATCH 06/14] fsi: sbefifo: Remove limits on user-specified read timeout Date: Mon, 12 Jun 2023 14:56:49 -0500 Message-Id: <20230612195657.245125-7-eajames@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230612195657.245125-1-eajames@linux.ibm.com> References: <20230612195657.245125-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: HO52h9VAJj3uso-jHawSe3hIam2Y-cvV X-Proofpoint-ORIG-GUID: HO52h9VAJj3uso-jHawSe3hIam2Y-cvV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-12_14,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=999 clxscore=1015 mlxscore=0 spamscore=0 suspectscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306120169 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768529394594994774?= X-GMAIL-MSGID: =?utf-8?q?1768529394594994774?= There's no reason to limit the user here. The way the driver is designed, extremely large transfers require extremely long timeouts. Signed-off-by: Eddie James --- drivers/fsi/fsi-sbefifo.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c index 5e6a9e08a92d..3364ddd90ee0 100644 --- a/drivers/fsi/fsi-sbefifo.c +++ b/drivers/fsi/fsi-sbefifo.c @@ -971,17 +971,12 @@ static int sbefifo_read_timeout(struct sbefifo_user *user, void __user *argp) if (timeout == 0) { user->read_timeout_ms = SBEFIFO_TIMEOUT_START_RSP; - dev_dbg(dev, "Timeout reset to %d\n", user->read_timeout_ms); + dev_dbg(dev, "Timeout reset to %us\n", user->read_timeout_ms / 1000); return 0; } - if (timeout < 10 || timeout > 120) - return -EINVAL; - user->read_timeout_ms = timeout * 1000; /* user timeout is in sec */ - - dev_dbg(dev, "Timeout set to %d\n", user->read_timeout_ms); - + dev_dbg(dev, "Timeout set to %us\n", timeout); return 0; } From patchwork Mon Jun 12 19:56:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 106794 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp109985vqr; Mon, 12 Jun 2023 13:15:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5jWiXHGzljMFb7wMjLRV9ByTkjNVu0ll1iVrDawj3OEupHK0mhImlS9mVA2XLyOeO8SnHf X-Received: by 2002:a17:902:d48f:b0:1b2:1942:9117 with SMTP id c15-20020a170902d48f00b001b219429117mr8331162plg.45.1686600911294; Mon, 12 Jun 2023 13:15:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686600911; cv=none; d=google.com; s=arc-20160816; b=dzhjqDJXfDMA7pUh4fn1r1hY6oc0nvTUqIR0PO3poIT/f98C2b6uJLKR6zC3oBnyUM 8c/xsqC5suH1q5xj5Wl04kwC959lva4xwzsc1IEGGLu6bqu9pgyaR5OAkL6cq5QWlak8 MfIg24P0bytPfc7c729J3y3q5WmL3QbMi+xmTltuKVxIZyxpLuVsotI1e64It+pQAzKW fifps3gY8lLVaHcnxTqB7QhV7iSUtnmm2MDjJd7NyGsFBBOD1RqnzcskLmGiWOOgS+oK k8qY8fwW39byq4JmfZb64OXzZGbNRTw2bRC9FXny0E55T2Byv7YW6hGz6TLQ1OwWl+R6 4aiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=465gFYFssJaxy+OBtrrumggMCxpVdQ+LRKOynshzTU0=; b=Mq1qt46e5HNYI+Uu8ZQzLb9/MIs8gIn7JOXZoKU+Syx9qRa8n2AFe/HN7OvywP3Cgo eDUA7zlXTzPbPMvVs499hBV6j871PmChK4N8/9l0ATiJiLaVU2ShNa7K3hr48+O0o2pA dgNC4Esp3jUcIpR1q1gnuFduwhMUa1PgirzZLCjnHO5zoa8icOipHOtNqhflJBci1L4A nd8+zO+jHaHNPReCzzzRaGnWLO5okXYCAV9WWxUvEK2Eo3cJJEk2e9xj2yFZVJEREDAW OuBf3vTQZYIPaq2oOqy3OAOEtv7s3tpTYI+XpR3hZemkteTmf7wT2dpvmf0PdHKMrsVf 8dgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="T/ToVz5T"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x4-20020a170902ec8400b001a97262fe53si7636023plg.552.2023.06.12.13.14.59; Mon, 12 Jun 2023 13:15:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="T/ToVz5T"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230331AbjFLT6P (ORCPT + 99 others); Mon, 12 Jun 2023 15:58:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237863AbjFLT5Z (ORCPT ); Mon, 12 Jun 2023 15:57:25 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B4E010FA; Mon, 12 Jun 2023 12:57:25 -0700 (PDT) Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJl0eF022837; Mon, 12 Jun 2023 19:57:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=465gFYFssJaxy+OBtrrumggMCxpVdQ+LRKOynshzTU0=; b=T/ToVz5To7wXoQDm75/o+PlWUayYU1vY+zu3iNo75WkbSR/zFcO00Q9V6ZTwJa6q8h1b 54aEpAMgY0PqAsP7QZ2UYCLczFNOIELc8DxX5KSmnluiEXqeIZKSIgKKNbmf5hA/Vrmw Q+//s1tbSGHVvqZO2Jny8lOMJ6uzxwWoD0ZjJ+Mv7zIcFvHPXst7KlUCHxdChj9Lsm8N OzA1kuSvKiRuufbdlnutvIyb5eLJzXO2QUOC1whUlOxE7qMy0SanMzO3ctv1Ukb/Biug 86IUDcgVn/v11xSjRris8IFu92wlECMoq/xfUcluFsH6Kj4Yfkz6Ehp9+xeh+CA6JDTM XQ== Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r69tn06d3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:02 +0000 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35CHFwEc014073; Mon, 12 Jun 2023 19:57:01 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([9.208.130.97]) by ppma05wdc.us.ibm.com (PPS) with ESMTPS id 3r4gt5cnbp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:01 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35CJv0ko23528116 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jun 2023 19:57:00 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 608F15805D; Mon, 12 Jun 2023 19:57:00 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1270E58060; Mon, 12 Jun 2023 19:57:00 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.148.226]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Jun 2023 19:57:00 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, andrew@aj.id.au, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org Subject: [PATCH 07/14] fsi: aspeed: Reset master errors after CFAM reset Date: Mon, 12 Jun 2023 14:56:50 -0500 Message-Id: <20230612195657.245125-8-eajames@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230612195657.245125-1-eajames@linux.ibm.com> References: <20230612195657.245125-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: P6oPDhoMvPwOePqYNXa2rUtKr6CanAcR X-Proofpoint-GUID: P6oPDhoMvPwOePqYNXa2rUtKr6CanAcR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-12_14,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 phishscore=0 clxscore=1015 malwarescore=0 spamscore=0 priorityscore=1501 adultscore=0 bulkscore=0 impostorscore=0 mlxlogscore=983 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306120169 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768529236718932415?= X-GMAIL-MSGID: =?utf-8?q?1768529236718932415?= It has been observed that sometimes the FSI master will return all 0xffs after a CFAM has been taken out of reset, without presenting any error. Resetting the FSI master errors resolves the issue. Fixes: 4a851d714ead ("fsi: aspeed: Support CFAM reset GPIO") Signed-off-by: Eddie James --- drivers/fsi/fsi-master-aspeed.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index 437f87b4a6a3..f0a19cd451a0 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -454,6 +454,8 @@ static ssize_t cfam_reset_store(struct device *dev, struct device_attribute *att gpiod_set_value(aspeed->cfam_reset_gpio, 1); usleep_range(900, 1000); gpiod_set_value(aspeed->cfam_reset_gpio, 0); + usleep_range(900, 1000); + opb_writel(aspeed, ctrl_base + FSI_MRESP0, cpu_to_be32(FSI_MRESP_RST_ALL_MASTER)); mutex_unlock(&aspeed->lock); trace_fsi_master_aspeed_cfam_reset(false); From patchwork Mon Jun 12 19:56:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 106792 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp109507vqr; Mon, 12 Jun 2023 13:14:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4SE74ky9RxskRM1eD55aBu4zv30MlKY3541FyPfCOqsNor0K4qIpd/v5MpeuoihSDFZCIn X-Received: by 2002:a17:902:6bc3:b0:1b1:9272:55f3 with SMTP id m3-20020a1709026bc300b001b1927255f3mr6717253plt.66.1686600850567; Mon, 12 Jun 2023 13:14:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686600850; cv=none; d=google.com; s=arc-20160816; b=k5m9WQdZ7/FahRzTUBm8Bw/vXuv2LvqvXuGuct6q6NhcFVwOniVzDCDRJf2ioP+cnS +xe84BWgqAlmufPrdlrXNL6Nc4Kq833egZkmSyOjBn4lXTQXp/7p+j/aSSpX4y0nrkXI lw1qQWSUjgpbaa2kJI+qlc+WkzEXYUpoTEFc/bh6OXUO5eeDNBFdqs4zMGav5OVw0JnS Jx+stWvRiQR6+5Cgq1EAQv31kFTbev9nfN0gkkowATiQCHjbIVEYYJvFgdPgq45m93NK 3HCgdjzGplrGainN4Me0XWLfcj/BmlYmxfc1ZrKWu1SSjQ3+kc0PJ5q0VjRAtRbLMxPD t70A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dWDtZcUOcpdXqOdxgV8A174M9rHaNyLBSCJnuRYzgcw=; b=AJoF6pRT7EJd/KnxDeXxkDuvXPfNTS+/HDjstj6cKZcdG6tpK4H5rtcwlhuK2SCO+8 eaYDB3aNkqzR0ese2b1KBF3VPEicJbzItrIhwtxZ7ITsJlqqm2zZE1fB1UiMi6An4OT4 r4h1LFtrkJv9//WTH9QMM1SrObunxEwGTARhns/kcSFpNldQMsykewRrB3D9Kpwqb1Bm uaxjtTODE2AwQGSiGgEQlQlVHgo4H5Z0XS45n3Omc8ipRpVwBfBne03STjWY9/FPFCRg +4Gx0m4urun0AXe+/s8u9tSaDoadjGtPFGzPbvTw3Lo87QY35nFp4Ef2FxlHVVpqAF6f /bzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=AeW4w+N+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v18-20020a170902ca9200b001a664075202si2180286pld.542.2023.06.12.13.13.57; Mon, 12 Jun 2023 13:14:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=AeW4w+N+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238179AbjFLT5l (ORCPT + 99 others); Mon, 12 Jun 2023 15:57:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233166AbjFLT5T (ORCPT ); Mon, 12 Jun 2023 15:57:19 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 960F910F9; Mon, 12 Jun 2023 12:57:17 -0700 (PDT) Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJqfKp024974; Mon, 12 Jun 2023 19:57:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=dWDtZcUOcpdXqOdxgV8A174M9rHaNyLBSCJnuRYzgcw=; b=AeW4w+N+zkSxHLgHPqe8uOJMPnhVZQrVk5avuyIeBaouqbjJuV3LnoAmjC56Dab2DZs8 TM85BPTXVtA+WPtujTFPVRAOGryQsA5IJgbkACqv/78Vjo+Pf8qWtspsdditF5/tDXG2 Jx9+HNWWnh0mZVHFmdWQ+fb+rYB9p8RaFyXbr1shbgNwfui31mNE2Bwj36JL++tMJ0GF sTFfaSMo1f9YT/aRH66ukLrEhibkafn/gPAUNS/4dEuy2gvUlm3DN05D/8klR90WwLH3 vzqHIGGEX7+qhz3TFRYZG2wTu02p2JmcVfjXXc7wR7ApOq4QsYu2dDqRJ40O+Al4qbbY KA== Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r69wgr319-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:02 +0000 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35CHiUff002850; Mon, 12 Jun 2023 19:57:01 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([9.208.130.97]) by ppma03wdc.us.ibm.com (PPS) with ESMTPS id 3r4gt5cm97-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:01 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35CJv06I37290454 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jun 2023 19:57:00 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B6D3458055; Mon, 12 Jun 2023 19:57:00 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6A3485805E; Mon, 12 Jun 2023 19:57:00 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.148.226]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Jun 2023 19:57:00 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, andrew@aj.id.au, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org Subject: [PATCH 08/14] fsi: core: Add trace events for scan and unregister Date: Mon, 12 Jun 2023 14:56:51 -0500 Message-Id: <20230612195657.245125-9-eajames@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230612195657.245125-1-eajames@linux.ibm.com> References: <20230612195657.245125-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: TlOGmbcfCvSmwOdRYZjHC-4uAX4tHyDs X-Proofpoint-ORIG-GUID: TlOGmbcfCvSmwOdRYZjHC-4uAX4tHyDs X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-12_14,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 bulkscore=0 spamscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 phishscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306120169 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768529173439024023?= X-GMAIL-MSGID: =?utf-8?q?1768529173439024023?= Add more trace events for the scanning and unregistration functions for debug purposes. Signed-off-by: Eddie James Reviewed-by: Joel Stanley --- drivers/fsi/fsi-core.c | 4 ++++ include/trace/events/fsi.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index ca4a9634fbc3..47e47c16d5ed 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -1220,6 +1220,7 @@ static int fsi_master_scan(struct fsi_master *master) { int link, rc; + trace_fsi_master_scan(master, true); for (link = 0; link < master->n_links; link++) { rc = fsi_master_link_enable(master, link); if (rc) { @@ -1261,6 +1262,7 @@ static int fsi_master_remove_slave(struct device *dev, void *arg) static void fsi_master_unscan(struct fsi_master *master) { + trace_fsi_master_scan(master, false); device_for_each_child(&master->dev, NULL, fsi_master_remove_slave); } @@ -1349,6 +1351,8 @@ EXPORT_SYMBOL_GPL(fsi_master_register); void fsi_master_unregister(struct fsi_master *master) { + trace_fsi_master_unregister(master); + if (master->idx >= 0) { ida_simple_remove(&master_ida, master->idx); master->idx = -1; diff --git a/include/trace/events/fsi.h b/include/trace/events/fsi.h index c9a72e8432b8..5ff15126ad9d 100644 --- a/include/trace/events/fsi.h +++ b/include/trace/events/fsi.h @@ -122,6 +122,37 @@ TRACE_EVENT(fsi_master_break, ) ); +TRACE_EVENT(fsi_master_scan, + TP_PROTO(const struct fsi_master *master, bool scan), + TP_ARGS(master, scan), + TP_STRUCT__entry( + __field(int, master_idx) + __field(int, n_links) + __field(bool, scan) + ), + TP_fast_assign( + __entry->master_idx = master->idx; + __entry->n_links = master->n_links; + __entry->scan = scan; + ), + TP_printk("fsi%d (%d links) %s", __entry->master_idx, __entry->n_links, + __entry->scan ? "scan" : "unscan") +); + +TRACE_EVENT(fsi_master_unregister, + TP_PROTO(const struct fsi_master *master), + TP_ARGS(master), + TP_STRUCT__entry( + __field(int, master_idx) + __field(int, n_links) + ), + TP_fast_assign( + __entry->master_idx = master->idx; + __entry->n_links = master->n_links; + ), + TP_printk("fsi%d (%d links)", __entry->master_idx, __entry->n_links) +); + TRACE_EVENT(fsi_slave_init, TP_PROTO(const struct fsi_slave *slave), TP_ARGS(slave), From patchwork Mon Jun 12 19:56:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 106795 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp110039vqr; Mon, 12 Jun 2023 13:15:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ45LxwoKPctaZOa0e5Tops6YJD1u3kBQWxFnXOI4fbSsR5eDDp+n9lPy1UL0WR2Jwl7gmic X-Received: by 2002:a17:90a:1d5:b0:25b:d369:6e37 with SMTP id 21-20020a17090a01d500b0025bd3696e37mr4315455pjd.1.1686600918269; Mon, 12 Jun 2023 13:15:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686600918; cv=none; d=google.com; s=arc-20160816; b=x7q4qyQKTRKk8uHC6AUV+Clr6sxzTdToquYRyK++vvTAPnopS60Lxw1Abo+OcOKdaZ LrCLZrICt4TYFjKqRn3pjD5MRTYADtd+Ix5lp8Ve/AAhgEaoMSF4mx9SpzH/xPinhfwi BgiQse//mL5X8GI0KpY+HaEY6520SY9DV6951uK4+I406OJmeS/eN+UH1bheeHd1YcJa pnkI6YZsLtNjfLX42CpMNLdOt/3zvZ3ftKF2wZJhvuKaZ8vyUdfPBBet6OK7tIr7aapU zWJWN1k9lu3pLobqtPzkS5co+Gq2M9Wgln1WErOZsqKib5jzLyRn9SCN2IwJ/0s7xVHb 7y+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Z50hVAq6eoFMEtoYlp7dlPzK8gihaJtCWPqn2TSso1g=; b=nofphj3ux4jqaV0z8a3W2tH47U/pv+XLM8hS2yKHnS7mL5V0SumVC897xMVeDRFvM+ xW2yPfOSIQwkJ5v3SFL+gm1zMn1HEk+ju1fVibsmGF5oNKSF1VBA/AZCRAA0ZFl+o9Bm QpihmJvoQuo+/UA/+DHflG0MQ0lx8whpXOokHVaVfetFo8/kffp+CjcgsmO6KFHCd4/t SeQQv30l0Gqtwhi0vjM3tQm8NlRUqQnats+axCTBzYyZhs5zM9mm+/etB5n46dzHeCuI uz1836me2LnCKaXS3pvEl3QjEYfG1rifvSMOorUptaynqsZZR6z0IK5NCkS0XY8VySwe /mbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="b8q/HiE0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg8-20020a17090b300800b0025546028cbesi382479pjb.31.2023.06.12.13.15.05; Mon, 12 Jun 2023 13:15:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="b8q/HiE0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238309AbjFLT5o (ORCPT + 99 others); Mon, 12 Jun 2023 15:57:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233481AbjFLT5T (ORCPT ); Mon, 12 Jun 2023 15:57:19 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3807FE71; Mon, 12 Jun 2023 12:57:18 -0700 (PDT) Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJk1vO006928; Mon, 12 Jun 2023 19:57:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=Z50hVAq6eoFMEtoYlp7dlPzK8gihaJtCWPqn2TSso1g=; b=b8q/HiE0SM4P8FKcDNxFT92HObAhtyDo8MgVi37gux7CQ20j2e8unby3ImDtOnB+C/d6 9ZlEAYfYsgMvj1StGE5isI92UI0Hfuq9it/MO3u//lRFzCj0xEQQhnOFecGUmlxXMbU5 2keLL12EMZQIkRoTOPNCSqnSDmuk/BMjEX7VAd/YGehcId2AmWH5C1x5162oR9doOIZa 0dEolXbUkQmmCQMcUrSmF5ozbaFW0iolZQBxO5PsxsKZ32WGzq/mcmk1r7OUQEL7Ow70 wTzU7m1UEe0UvuKrO0eLcvZvtFcbtqknzGx/XoL/6ACI1gRxb5QcTm5LcT0HfTDu/b1e qg== Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r69t5885e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:03 +0000 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35CHnIxt002906; Mon, 12 Jun 2023 19:57:01 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([9.208.130.98]) by ppma03wdc.us.ibm.com (PPS) with ESMTPS id 3r4gt5cm98-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:01 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35CJv1dh3277396 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jun 2023 19:57:01 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1232B58055; Mon, 12 Jun 2023 19:57:01 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C101F58043; Mon, 12 Jun 2023 19:57:00 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.148.226]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Jun 2023 19:57:00 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, andrew@aj.id.au, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org Subject: [PATCH 09/14] fsi: core: Fix legacy minor numbering Date: Mon, 12 Jun 2023 14:56:52 -0500 Message-Id: <20230612195657.245125-10-eajames@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230612195657.245125-1-eajames@linux.ibm.com> References: <20230612195657.245125-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: -2mpnwjYVlo9eDPKlyQGdtdP1Wrh-hd0 X-Proofpoint-ORIG-GUID: -2mpnwjYVlo9eDPKlyQGdtdP1Wrh-hd0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-12_14,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 mlxscore=0 malwarescore=0 spamscore=0 impostorscore=0 lowpriorityscore=0 adultscore=0 bulkscore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306120169 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768529244392814482?= X-GMAIL-MSGID: =?utf-8?q?1768529244392814482?= From: Eddie James The legacy minor numbering shifts the chip id too much, resulting in ids that overlap with regular ids. Since there are only 2 bits for 4 types, only shift the chip id by 2 to fit the legacy ids in their reserved space. Signed-off-by: Eddie James --- drivers/fsi/fsi-core.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 47e47c16d5ed..ea280f149b3f 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -934,8 +934,12 @@ static int __fsi_get_new_minor(struct fsi_slave *slave, enum fsi_dev_type type, /* Check if we qualify for legacy numbering */ if (cid >= 0 && cid < 16 && type < 4) { - /* Try reserving the legacy number */ - id = (cid << 4) | type; + /* + * Try reserving the legacy number, which has 0 - 0x3f reserved + * in the ida range. cid goes up to 0xf and type contains two + * bits, so construct the id with the below two bit shift. + */ + id = (cid << 2) | type; id = ida_simple_get(&fsi_minor_ida, id, id + 1, GFP_KERNEL); if (id >= 0) { *out_index = fsi_adjust_index(cid); @@ -970,7 +974,8 @@ int fsi_get_new_minor(struct fsi_device *fdev, enum fsi_dev_type type, int aid = of_alias_get_id(fdev->dev.of_node, fsi_dev_type_names[type]); if (aid >= 0) { - int id = (aid << 4) | type; + /* Use the same scheme as the legacy numbers. */ + int id = (aid << 2) | type; id = ida_simple_get(&fsi_minor_ida, id, id + 1, GFP_KERNEL); if (id >= 0) { From patchwork Mon Jun 12 19:56:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 106796 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp110088vqr; Mon, 12 Jun 2023 13:15:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4zfg4f/aTN6U5P7v3z+E8c4lMcE7+aPJ5QYZ5P+wz85iI1P2FU3TguN1uODeKxDTdDoJKe X-Received: by 2002:a05:6a20:a5a8:b0:10b:6b1f:c8c8 with SMTP id bc40-20020a056a20a5a800b0010b6b1fc8c8mr8830799pzb.31.1686600924934; Mon, 12 Jun 2023 13:15:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686600924; cv=none; d=google.com; s=arc-20160816; b=KmqrCymgHBWmlVukYsaI3P934w+BQPJHrTMtPNbQQKRHObzdwcurFNh44nxxuHuCe2 Z2rOH/T6mGbElKaeF9bZE8VmvAfvZffIpjoASvmTBdd+2iPFw1tyq/85UGcSOANdLR1o 8QV5C3YWxCPbq+zN+gLnzezoQQTgCLNtogFxnkqJe3JgvGzBHTiaHcpCJA06V+yoeaOJ y+HHMnhPUjaOVUvPXL6jX/Lkj2rxvsywfNhlUrroO7GtAazAAi+EfmGiY4qwTU7WgY7E NmBWpI/9jbkPQOWUbOiQHL5EgJXrLfLgD5EQhbAATcgzxOh2qtsAm8r8sV1o8nQZNyDQ +ESQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6fYsGoqmdKHTOzWXutB3JtgK6QmYKKedH3x7L/igIf4=; b=muwpzypPeGecAyP46oiLs8fTX8Nc6tJYuJuFncN6nKwiMcsX1XlQdQmulxI1D5AAX3 cWitJ3jRaPrKgp2/4Ex6UzrsTZ1TckMYT2F0s+LWd5GcJROsgZf3TKbEvBJmwIZgmceo aBKo3Q3tUyqZ45KIQLIcjZmsIGrv9PhGix6l0MyQfsw4aGd/O/qfhqLmoYPSAwLAOgpR 9nnY/KJB/yFADhnkDrkPIqkq4PzyvJjl94hdmWZs5fI4ENTEnMc7zbDLttmcmWVjv4ga QTmEmPhpT7M5SQNqCS43JbDNHSA18n+1CrueNINQXtvyVWxtGc6GKqv4IvVJ7LhA5B/l wISQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="h/ffu0Kr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u5-20020a634705000000b00542d2508ac7si4273668pga.200.2023.06.12.13.15.12; Mon, 12 Jun 2023 13:15:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="h/ffu0Kr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238319AbjFLT5z (ORCPT + 99 others); Mon, 12 Jun 2023 15:57:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234400AbjFLT5T (ORCPT ); Mon, 12 Jun 2023 15:57:19 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F12CAE77; Mon, 12 Jun 2023 12:57:18 -0700 (PDT) Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJokTh021189; Mon, 12 Jun 2023 19:57:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=6fYsGoqmdKHTOzWXutB3JtgK6QmYKKedH3x7L/igIf4=; b=h/ffu0Krm9yQNL99rAcKMBGfK/U0FhUusCxHZ/GTiHh9KPNN2L8TTWCrh+dwRB4G2FlY 04DeRU9RndwvtzKZC06j2B4NeRZN9EB0/FiiVofA9w5YUmL48ky0MeyrthddkJDH/RtN EsFizATMmSk3tOAuMk9IrQm78AsGaLuhaKdyiYfhGAXCcjUBXuk1n7OIAMr+CGUfc1aL pAj8fq46IooxEAJpVjgL6W8nwh0ErfewNmvMilWSClzFLkI9U8T5tOe9tUSp/ppbrr9T aqy4vRQq5z3YaDwUIc8eDrySZMwXKtBuu4XNZcxBhQlzZphdQSGvQ/a3kPWdrMCxF2vH 4A== Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r69vjg2wn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:03 +0000 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJSw0k011868; Mon, 12 Jun 2023 19:57:02 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([9.208.130.98]) by ppma04dal.us.ibm.com (PPS) with ESMTPS id 3r4gt5krsh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:02 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35CJv1FH3277398 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jun 2023 19:57:01 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6359858043; Mon, 12 Jun 2023 19:57:01 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1BBC85805D; Mon, 12 Jun 2023 19:57:01 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.148.226]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Jun 2023 19:57:01 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, andrew@aj.id.au, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org Subject: [PATCH 10/14] fsi: core: Switch to ida_alloc/free Date: Mon, 12 Jun 2023 14:56:53 -0500 Message-Id: <20230612195657.245125-11-eajames@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230612195657.245125-1-eajames@linux.ibm.com> References: <20230612195657.245125-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: R6gZ3YMJcpz_B0JAp8hBCMVtv35a_7y6 X-Proofpoint-GUID: R6gZ3YMJcpz_B0JAp8hBCMVtv35a_7y6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-12_14,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 clxscore=1015 mlxscore=0 adultscore=0 spamscore=0 suspectscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306120169 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768529251347019313?= X-GMAIL-MSGID: =?utf-8?q?1768529251347019313?= ida_simple_get/remove are deprecated, so switch to ida_alloc/free. Signed-off-by: Eddie James --- drivers/fsi/fsi-core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index ea280f149b3f..ec4d02264391 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -940,7 +940,7 @@ static int __fsi_get_new_minor(struct fsi_slave *slave, enum fsi_dev_type type, * bits, so construct the id with the below two bit shift. */ id = (cid << 2) | type; - id = ida_simple_get(&fsi_minor_ida, id, id + 1, GFP_KERNEL); + id = ida_alloc_range(&fsi_minor_ida, id, id, GFP_KERNEL); if (id >= 0) { *out_index = fsi_adjust_index(cid); *out_dev = fsi_base_dev + id; @@ -951,8 +951,8 @@ static int __fsi_get_new_minor(struct fsi_slave *slave, enum fsi_dev_type type, return id; /* Fallback to non-legacy allocation */ } - id = ida_simple_get(&fsi_minor_ida, FSI_CHAR_LEGACY_TOP, - FSI_CHAR_MAX_DEVICES, GFP_KERNEL); + id = ida_alloc_range(&fsi_minor_ida, FSI_CHAR_LEGACY_TOP, + FSI_CHAR_MAX_DEVICES - 1, GFP_KERNEL); if (id < 0) return id; *out_index = fsi_adjust_index(id); @@ -977,7 +977,7 @@ int fsi_get_new_minor(struct fsi_device *fdev, enum fsi_dev_type type, /* Use the same scheme as the legacy numbers. */ int id = (aid << 2) | type; - id = ida_simple_get(&fsi_minor_ida, id, id + 1, GFP_KERNEL); + id = ida_alloc_range(&fsi_minor_ida, id, id, GFP_KERNEL); if (id >= 0) { *out_index = aid; *out_dev = fsi_base_dev + id; @@ -995,7 +995,7 @@ EXPORT_SYMBOL_GPL(fsi_get_new_minor); void fsi_free_minor(dev_t dev) { - ida_simple_remove(&fsi_minor_ida, MINOR(dev)); + ida_free(&fsi_minor_ida, MINOR(dev)); } EXPORT_SYMBOL_GPL(fsi_free_minor); @@ -1330,7 +1330,7 @@ int fsi_master_register(struct fsi_master *master) struct device_node *np; mutex_init(&master->scan_lock); - master->idx = ida_simple_get(&master_ida, 0, INT_MAX, GFP_KERNEL); + master->idx = ida_alloc(&master_ida, GFP_KERNEL); if (master->idx < 0) return master->idx; @@ -1339,7 +1339,7 @@ int fsi_master_register(struct fsi_master *master) rc = device_register(&master->dev); if (rc) { - ida_simple_remove(&master_ida, master->idx); + ida_free(&master_ida, master->idx); return rc; } @@ -1359,7 +1359,7 @@ void fsi_master_unregister(struct fsi_master *master) trace_fsi_master_unregister(master); if (master->idx >= 0) { - ida_simple_remove(&master_ida, master->idx); + ida_free(&master_ida, master->idx); master->idx = -1; } From patchwork Mon Jun 12 19:56:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 106788 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp101838vqr; Mon, 12 Jun 2023 13:00:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7CBouxMS0fv4p6QtLsdChF0ob0qDGv39Sh7Xmz3STPB7cdajT3ta2HYx+G7c22M9iHHnSe X-Received: by 2002:a05:6402:3506:b0:514:a21b:f137 with SMTP id b6-20020a056402350600b00514a21bf137mr6556365edd.6.1686600034338; Mon, 12 Jun 2023 13:00:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686600034; cv=none; d=google.com; s=arc-20160816; b=KoQJCcm7c+Ag2NGjxjNX488mQWQ7uNQS2HYObIzsl090FRwfIiD2IoUsmcL4JeIkbF 95T3sjQev1JyP40DvtjE3uH5JaWQ2FWJj0VCCLZwjSYP4vTTTrzFcUZ0TQMRhaS02mNA vIFBE/JuO3W1hgtJTy5oVY+ZVvyzTMclc7cuVvd0gzd3XKIYCPuvJMDsuOQYcD7/R0vS ICk3TFCVmk8DOPvHY+OevBJyoJfQYs+QfMyCuHdPbH8ajR67ePFJDYacI4YasUUovXTc Zyfjmabg5hnTJnUzLnbE49VSk/lQSxJLWaUhmpldCAz1oEioj1TjGl+iB58qQryDjzkL tQBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zkjo7yw+XyzaXEbEFhbeLIcrenF/SgLQDubhtwnz964=; b=VYy0FV7JUbgFqThUuYgF1dkb3e2IgH4ZXWAfmBLiihoLLfUJvN/XoM5gycI6+uNe9x zwGT44rHaZy4hJsCiiBUKmDZCdFS/GhdQsQ3KK7shjv66zw53V8CizfkrxRg3cjK+Val x1i/boaojsFUIDS/uXCXeimJxNqhwK5uTeyfywIGKZNNYTTvVlK8uuYFMfyc9LY8RQUq TLOQoZdI+SrpTUXOf3/EV3f/WA8qZGzONhVA1kFYGpWbM69K6DL6V1KRnYk89qKKGeXb bRrYCO2qTtorTGan8lwcSRq9TORnpHzOMoBJmO9M5fA1p21/IKoIAwQ559J57x9mof0S byMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=SrptcaKH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l6-20020aa7d946000000b00514b957c9dfsi6244649eds.571.2023.06.12.13.00.07; Mon, 12 Jun 2023 13:00:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=SrptcaKH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238256AbjFLT5c (ORCPT + 99 others); Mon, 12 Jun 2023 15:57:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231726AbjFLT5S (ORCPT ); Mon, 12 Jun 2023 15:57:18 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35F6910CC; Mon, 12 Jun 2023 12:57:17 -0700 (PDT) Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJl6gI006086; Mon, 12 Jun 2023 19:57:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=zkjo7yw+XyzaXEbEFhbeLIcrenF/SgLQDubhtwnz964=; b=SrptcaKHy414ZL73/2ZgKpgMcioAd2mVLbUr87dtCg32+TD6eBropJpZx2EGt8MWhSvp NJoRbc220y9O5OX3zqjMZerwCLUIuvhyJUY9/hNocf3lPRnst7nYf+Xuks7+x3PIjBoG Z515vSXImwu0PDOi30G9egl1wTpJ4erptTMEtzgsFI3JQSqIaWkZdrD/rC9X3zymFcPy p+YCx71RDRVD6kxSIO0SDuQ/MzhUeskzeE9/wUQZUQGbXmk+O/5HWwxO9VNrsTPK5fGu uct2NG0+F2hYfd3av3tpFsEch8B0v7t88fP2PVpBfS/VYa5Pi9BWXIQsVvBzUdkzbz6n oQ== Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r69tqg661-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:03 +0000 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJ0qZQ027199; Mon, 12 Jun 2023 19:57:02 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([9.208.130.98]) by ppma02dal.us.ibm.com (PPS) with ESMTPS id 3r4gt5krr6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:02 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35CJv1b451577340 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jun 2023 19:57:01 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B2A445805F; Mon, 12 Jun 2023 19:57:01 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6D4E25805E; Mon, 12 Jun 2023 19:57:01 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.148.226]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Jun 2023 19:57:01 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, andrew@aj.id.au, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org Subject: [PATCH 11/14] fsi: Improve master indexing Date: Mon, 12 Jun 2023 14:56:54 -0500 Message-Id: <20230612195657.245125-12-eajames@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230612195657.245125-1-eajames@linux.ibm.com> References: <20230612195657.245125-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: bYjn5AaMjBJ187RLnVB6mJMQ7ex554vw X-Proofpoint-GUID: bYjn5AaMjBJ187RLnVB6mJMQ7ex554vw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-12_14,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 impostorscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 spamscore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 adultscore=0 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306120169 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768528317865067576?= X-GMAIL-MSGID: =?utf-8?q?1768528317865067576?= Master indexing is problematic if a hub is rescanned while the root master is being rescanned. Move the IDA free below the device unregistration, lock the scan mutex in the probe function, and request a specific idx in the hub driver. Signed-off-by: Eddie James --- drivers/fsi/fsi-core.c | 41 ++++++++++++++++++++++-------------- drivers/fsi/fsi-master-hub.c | 2 ++ 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index ec4d02264391..503061a6740b 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -1327,46 +1327,55 @@ static struct class fsi_master_class = { int fsi_master_register(struct fsi_master *master) { int rc; - struct device_node *np; mutex_init(&master->scan_lock); - master->idx = ida_alloc(&master_ida, GFP_KERNEL); + + if (master->idx) { + master->idx = ida_alloc_range(&master_ida, master->idx, + master->idx, GFP_KERNEL); + if (master->idx < 0) + master->idx = ida_alloc(&master_ida, GFP_KERNEL); + } else { + master->idx = ida_alloc(&master_ida, GFP_KERNEL); + } + if (master->idx < 0) return master->idx; - dev_set_name(&master->dev, "fsi%d", master->idx); + if (!dev_name(&master->dev)) + dev_set_name(&master->dev, "fsi%d", master->idx); + master->dev.class = &fsi_master_class; + mutex_lock(&master->scan_lock); rc = device_register(&master->dev); if (rc) { ida_free(&master_ida, master->idx); - return rc; - } + } else { + struct device_node *np = dev_of_node(&master->dev); - np = dev_of_node(&master->dev); - if (!of_property_read_bool(np, "no-scan-on-init")) { - mutex_lock(&master->scan_lock); - fsi_master_scan(master); - mutex_unlock(&master->scan_lock); + if (!of_property_read_bool(np, "no-scan-on-init")) + fsi_master_scan(master); } - return 0; + mutex_unlock(&master->scan_lock); + return rc; } EXPORT_SYMBOL_GPL(fsi_master_register); void fsi_master_unregister(struct fsi_master *master) { - trace_fsi_master_unregister(master); + int idx = master->idx; - if (master->idx >= 0) { - ida_free(&master_ida, master->idx); - master->idx = -1; - } + trace_fsi_master_unregister(master); mutex_lock(&master->scan_lock); fsi_master_unscan(master); + master->n_links = 0; mutex_unlock(&master->scan_lock); + device_unregister(&master->dev); + ida_free(&master_ida, idx); } EXPORT_SYMBOL_GPL(fsi_master_unregister); diff --git a/drivers/fsi/fsi-master-hub.c b/drivers/fsi/fsi-master-hub.c index 6d8b6e8854e5..36da643b3201 100644 --- a/drivers/fsi/fsi-master-hub.c +++ b/drivers/fsi/fsi-master-hub.c @@ -12,6 +12,7 @@ #include #include "fsi-master.h" +#include "fsi-slave.h" #define FSI_ENGID_HUB_MASTER 0x1c @@ -229,6 +230,7 @@ static int hub_master_probe(struct device *dev) hub->master.dev.release = hub_master_release; hub->master.dev.of_node = of_node_get(dev_of_node(dev)); + hub->master.idx = fsi_dev->slave->link + 1; hub->master.n_links = links; hub->master.read = hub_master_read; hub->master.write = hub_master_write; From patchwork Mon Jun 12 19:56:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 106793 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp109780vqr; Mon, 12 Jun 2023 13:14:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5WnEbS5XL8shuqQn3ylgBAwWjp1NsbDSIDyp/9P7cXqtrd5krO/6ICotdX9AKOIgJjSEIj X-Received: by 2002:a05:6a21:6d88:b0:115:2b0e:3c3 with SMTP id wl8-20020a056a216d8800b001152b0e03c3mr12681862pzb.19.1686600886543; Mon, 12 Jun 2023 13:14:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686600886; cv=none; d=google.com; s=arc-20160816; b=OxmBzplAxVJ+RvcteDfCR/Y4mB0w0ShgITS4X7/8+vMuA+0jNsXXnF+iBBiKcQfSE8 +QfFMU4c4gebGJltuf1HtyhR43h5GRPkB8aSyC0giKD1RnZLsqPyuQbQ9PjU7QSgo5OA vM6Q2AOqmTYq/d7JTzS9+7RRhDWQMk6QwM+8e9+pE8NmeSku0tBGibemKkH5IHsf43MM +XKyHjJTOpPoFtidyLkeB/7GDgYu6LeBrshSuHL2K9n+Ob75VXXjblSuX9IKVJxhDosZ Q5/OGQsRL/Kw4LA5tJov7Sy7AQBLP4WnLzj+hKyakX9PqiSUFxKTr5UG3JpC/SZ7Z1hX jfGA== ARC-Message-Signature: i=1; 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=kX3Vl11fgpbcRT2Yp+QxdfAbvT5CTTbsQ0eGJvC1rnw=; b=fJ2fXjHxrwbPRnDYW0mEvcTk1ghJIkQs4g8aOzhH5harqKzjZ8a97h9bot+1fyKwaG ng1oWRgXJXbcPPcI2nf1+oxpb0z2attufOyhn2d4VGeasDBh4UfPMbk+x391nBZNXCQV Q/vLjzluUST2VvLzPdhrzzd56eILK/NJIYs9OEZMFONX0C4VaWTUbUn48E8xvwQaGiVG Vs1tC+pi9PU24LA9TmGdaoIQyyvkbzzy/4cK5dWQ1Qu894Uo0HXQKCJZTqf7wv548Kg+ 067dVU3dluBAAKs44RL5SKBiWr8O+1fkTNi2bn6J/7ZZH9y/cavnQBVuTtwUW2+5MH2H EuaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="G/NAXAS+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id az9-20020a056a02004900b005404f8dd0e8si7206500pgb.215.2023.06.12.13.14.33; Mon, 12 Jun 2023 13:14:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="G/NAXAS+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234565AbjFLT6K (ORCPT + 99 others); Mon, 12 Jun 2023 15:58:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237662AbjFLT5V (ORCPT ); Mon, 12 Jun 2023 15:57:21 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E412E71; Mon, 12 Jun 2023 12:57:20 -0700 (PDT) Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJpnfB007238; Mon, 12 Jun 2023 19:57:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=kX3Vl11fgpbcRT2Yp+QxdfAbvT5CTTbsQ0eGJvC1rnw=; b=G/NAXAS+C4LISWIgGIlBbe59q+KWRgy5IgqTeggjVK6+OSz9E+OjkaA1ORAA50ovEqMV 3Y2QlaDfra8Hox0cDT1v27TPg/stG6PhSXTN55uFhK/7SAypDgCK183eGH4xyANKPt8R WVmEdKXgMK2qwvDD1Xc1ZwldLUipUFMtAl+x1f7jnjCyAkBz2KjZWxfudFLtTxudm0w5 Xdf+feFW5DiWW8CEM+cMqZKH7dCSCSutJRzUov8/GWWAiIZOz7lnIZpqBwm6ZL3q57nm ULTSc2NfAPHvTtXGT0D/9OnMwreeGSrBJLmN/FtY3AfCA4qfATmJWIgJjnlr9TOTUljz 2g== Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r69w4829f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:04 +0000 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJ8oAw011879; Mon, 12 Jun 2023 19:57:03 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([9.208.130.102]) by ppma04dal.us.ibm.com (PPS) with ESMTPS id 3r4gt5krsj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:03 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35CJv2bY57737694 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jun 2023 19:57:02 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 13C1658043; Mon, 12 Jun 2023 19:57:02 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BC4E05805D; Mon, 12 Jun 2023 19:57:01 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.148.226]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Jun 2023 19:57:01 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, andrew@aj.id.au, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org Subject: [PATCH 12/14] dt-bindings: fsi: Document the IBM I2C Responder virtual FSI master Date: Mon, 12 Jun 2023 14:56:55 -0500 Message-Id: <20230612195657.245125-13-eajames@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230612195657.245125-1-eajames@linux.ibm.com> References: <20230612195657.245125-1-eajames@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: COxFuP2MtRtDASz-AOQA4VmmM1MihyHp X-Proofpoint-GUID: COxFuP2MtRtDASz-AOQA4VmmM1MihyHp X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-12_14,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306120169 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768529211210465766?= X-GMAIL-MSGID: =?utf-8?q?1768529211210465766?= The I2C Responder translates I2C commands to CFAM or SCOM operations, effectively implementing an FSI master. Signed-off-by: Eddie James Reviewed-by: Andrew Jeffery Reviewed-by: Krzysztof Kozlowski --- .../bindings/fsi/ibm,i2cr-fsi-master.yaml | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Documentation/devicetree/bindings/fsi/ibm,i2cr-fsi-master.yaml diff --git a/Documentation/devicetree/bindings/fsi/ibm,i2cr-fsi-master.yaml b/Documentation/devicetree/bindings/fsi/ibm,i2cr-fsi-master.yaml new file mode 100644 index 000000000000..442cecdc57cb --- /dev/null +++ b/Documentation/devicetree/bindings/fsi/ibm,i2cr-fsi-master.yaml @@ -0,0 +1,41 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/fsi/ibm,i2cr-fsi-master.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: IBM I2C Responder virtual FSI master + +maintainers: + - Eddie James + +description: | + The I2C Responder (I2CR) is a an I2C device that's connected to an FSI CFAM + (see fsi.txt). The I2CR translates I2C bus operations to FSI CFAM reads and + writes or SCOM operations, thereby acting as an FSI master. + +properties: + compatible: + enum: + - ibm,i2cr-fsi-master + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + i2cr@20 { + compatible = "ibm,i2cr-fsi-master"; + reg = <0x20>; + }; + }; From patchwork Mon Jun 12 19:56:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 106791 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp107986vqr; Mon, 12 Jun 2023 13:11:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6a2O5JplZ3VCglPg4H/xE2U8ZJX4qLPgXbMAuSD3sZ1uecHoOA/JCzGtWeKodqU1OG2n9k X-Received: by 2002:a17:906:fe45:b0:974:6de:8a5e with SMTP id wz5-20020a170906fe4500b0097406de8a5emr9461877ejb.40.1686600663386; Mon, 12 Jun 2023 13:11:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686600663; cv=none; d=google.com; s=arc-20160816; b=qK4JtOPs7Q3z+W1vFmtOa9VbN46Y/tr/pui6q205qkCLQBbvonP8ucBx65nPNm+t9s lcfo6zt+BwhErbDKvWil91KJzsJMKRsCMhfvknhtd/zyj78b3dDrbiCExhzK4zk1dufa cReVD4HyWu7O+/HuUmTAdSWCQ2hPSjkmdZcaCVXDWsBC6XsCPFIBjSj2O5vclG5Hflxf rQ8ojoT+dq23F2kdN4p61HXF4zYMAakF4gai7maXYTcVAMmGhBVUS4+FxIAm4pTPGwWn qXIW5WKVlAFxmMXfsW/n8EjfLriyFBMnIuErXjVfV+3mHq7rJpRSIDgmOMh8F9idAU02 s40w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PAAauk/MBIDBkulUZ9s2999ynLRXJIwzeNJ2iTp8zN8=; b=xiUQTJTc7QprIvrrY2l6Pg0uRtIHFKqxFiamJJiFyxkID4Fv3hSrHkcVZfDhVTXvrK vpfmtbTy45EEvSU4lYas6meb5afwlsIpUknop3FTiWgF1qLOh0L4Oko4DMbwwjBRZNf8 SYyUIeXa4Rf+WKyWPu30pQrDVYdv3Am2Jy1xkBcx4WNH+iiVFsjfVr48VLrF7B++TPpd 7IKAmufQa16EJViJ2YnmMr7akisY/Yj68Em7vT1rVWP3fVMND6G78OQ+KaTab/7lg1Ip ddfwErCOBany3hm0O2pg+swLhCLgivVpr2fhLlW8thDnMKXZBwXFehwNxqaGrxo3PIpK w53w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=M5SKSjgw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a1709065f8700b009823722b5d9si162638eju.1022.2023.06.12.13.10.38; Mon, 12 Jun 2023 13:11:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=M5SKSjgw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236807AbjFLT6A (ORCPT + 99 others); Mon, 12 Jun 2023 15:58:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236849AbjFLT5V (ORCPT ); Mon, 12 Jun 2023 15:57:21 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FA5D10CC; Mon, 12 Jun 2023 12:57:19 -0700 (PDT) Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJktms021897; Mon, 12 Jun 2023 19:57:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=PAAauk/MBIDBkulUZ9s2999ynLRXJIwzeNJ2iTp8zN8=; b=M5SKSjgwy4Qab/k2toPoEOV/fGATxC9f0WsQA68EmFowImwOIHUPRHCBCRuMyoUQF8S6 qEPcAVdVXKKIC+hDGsl7uKZ/+mJypkPXJzpdPEHr1IM2MKVQtBApR8NyoqLqD8pwE3Uo +O7NIask8FeHbwaTFQR5e5TD9Iu4eBlJvJYJ9Z2FrQ/lQRhsAR+cQ8hqpbKWjVSylRr5 9mRaJDoVcx3F+5nqohpJX49aa9R7Z61Ty6WIeOGUUqvgvQQdDrvCujmj+8jrx01QVZaW YZI5WjP1amIwtingXHJKC9vhW6MMOdQmahsGBZnqA2ruddLaa2aZy2iTdHNOzLa8/tBt bA== Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r69tqg6bh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:04 +0000 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJ5DeP027239; Mon, 12 Jun 2023 19:57:03 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([9.208.130.102]) by ppma02dal.us.ibm.com (PPS) with ESMTPS id 3r4gt5krr8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:03 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35CJv2t157737696 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jun 2023 19:57:02 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6CD8F58043; Mon, 12 Jun 2023 19:57:02 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1EA4C58055; Mon, 12 Jun 2023 19:57:02 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.148.226]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Jun 2023 19:57:02 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, andrew@aj.id.au, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org Subject: [PATCH 13/14] fsi: Add IBM I2C Responder virtual FSI master Date: Mon, 12 Jun 2023 14:56:56 -0500 Message-Id: <20230612195657.245125-14-eajames@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230612195657.245125-1-eajames@linux.ibm.com> References: <20230612195657.245125-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 3jec_YyfU2LCS1Sze_pswArchOLxJQ55 X-Proofpoint-ORIG-GUID: 3jec_YyfU2LCS1Sze_pswArchOLxJQ55 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-12_14,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=999 clxscore=1015 mlxscore=0 spamscore=0 suspectscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306120169 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768528977305419739?= X-GMAIL-MSGID: =?utf-8?q?1768528977305419739?= The I2C Responder (I2CR) is an I2C device that translates I2C commands to CFAM or SCOM operations, effectively implementing an FSI master and bus. Signed-off-by: Eddie James --- drivers/fsi/Kconfig | 9 + drivers/fsi/Makefile | 1 + drivers/fsi/fsi-master-i2cr.c | 316 +++++++++++++++++++++++++ drivers/fsi/fsi-master-i2cr.h | 33 +++ include/trace/events/fsi_master_i2cr.h | 107 +++++++++ 5 files changed, 466 insertions(+) create mode 100644 drivers/fsi/fsi-master-i2cr.c create mode 100644 drivers/fsi/fsi-master-i2cr.h create mode 100644 include/trace/events/fsi_master_i2cr.h diff --git a/drivers/fsi/Kconfig b/drivers/fsi/Kconfig index e6668a869913..999be82720c5 100644 --- a/drivers/fsi/Kconfig +++ b/drivers/fsi/Kconfig @@ -62,6 +62,15 @@ config FSI_MASTER_ASPEED Enable it for your BMC kernel in an OpenPower or IBM Power system. +config FSI_MASTER_I2CR + tristate "IBM I2C Responder virtual FSI master" + depends on I2C + help + This option enables a virtual FSI master in order to access a CFAM + behind an IBM I2C Responder (I2CR) chip. The I2CR is an I2C device + that translates I2C commands to CFAM or SCOM operations, effectively + implementing an FSI master and bus. + config FSI_SCOM tristate "SCOM FSI client device driver" help diff --git a/drivers/fsi/Makefile b/drivers/fsi/Makefile index da218a1ad8e1..34dbaa1c452e 100644 --- a/drivers/fsi/Makefile +++ b/drivers/fsi/Makefile @@ -4,6 +4,7 @@ obj-$(CONFIG_FSI) += fsi-core.o obj-$(CONFIG_FSI_MASTER_HUB) += fsi-master-hub.o obj-$(CONFIG_FSI_MASTER_ASPEED) += fsi-master-aspeed.o obj-$(CONFIG_FSI_MASTER_GPIO) += fsi-master-gpio.o +obj-$(CONFIG_FSI_MASTER_I2CR) += fsi-master-i2cr.o obj-$(CONFIG_FSI_MASTER_AST_CF) += fsi-master-ast-cf.o obj-$(CONFIG_FSI_SCOM) += fsi-scom.o obj-$(CONFIG_FSI_SBEFIFO) += fsi-sbefifo.o diff --git a/drivers/fsi/fsi-master-i2cr.c b/drivers/fsi/fsi-master-i2cr.c new file mode 100644 index 000000000000..61659c27a973 --- /dev/null +++ b/drivers/fsi/fsi-master-i2cr.c @@ -0,0 +1,316 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) IBM Corporation 2023 */ + +#include +#include +#include +#include +#include +#include + +#include "fsi-master-i2cr.h" + +#define CREATE_TRACE_POINTS +#include + +#define I2CR_ADDRESS_CFAM(a) ((a) >> 2) +#define I2CR_INITIAL_PARITY true + +#define I2CR_STATUS_CMD 0x60002 +#define I2CR_STATUS_ERR BIT_ULL(61) +#define I2CR_ERROR_CMD 0x60004 +#define I2CR_LOG_CMD 0x60008 + +static const u8 i2cr_cfam[] = { + 0xc0, 0x02, 0x0d, 0xa6, + 0x80, 0x01, 0x10, 0x02, + 0x80, 0x01, 0x10, 0x02, + 0x80, 0x01, 0x10, 0x02, + 0x80, 0x01, 0x80, 0x52, + 0x80, 0x01, 0x10, 0x02, + 0x80, 0x01, 0x10, 0x02, + 0x80, 0x01, 0x10, 0x02, + 0x80, 0x01, 0x10, 0x02, + 0x80, 0x01, 0x22, 0x2d, + 0x00, 0x00, 0x00, 0x00, + 0xde, 0xad, 0xc0, 0xde +}; + +static bool i2cr_check_parity32(u32 v, bool parity) +{ + u32 i; + + for (i = 0; i < 32; ++i) { + if (v & (1u << i)) + parity = !parity; + } + + return parity; +} + +static bool i2cr_check_parity64(u64 v) +{ + u32 i; + bool parity = I2CR_INITIAL_PARITY; + + for (i = 0; i < 64; ++i) { + if (v & (1llu << i)) + parity = !parity; + } + + return parity; +} + +static u32 i2cr_get_command(u32 address, bool parity) +{ + address <<= 1; + + if (i2cr_check_parity32(address, parity)) + address |= 1; + + return address; +} + +static int i2cr_transfer(struct i2c_client *client, u32 command, u64 *data) +{ + struct i2c_msg msgs[2]; + int ret; + + msgs[0].addr = client->addr; + msgs[0].flags = 0; + msgs[0].len = sizeof(command); + msgs[0].buf = (__u8 *)&command; + msgs[1].addr = client->addr; + msgs[1].flags = I2C_M_RD; + msgs[1].len = sizeof(*data); + msgs[1].buf = (__u8 *)data; + + ret = i2c_transfer(client->adapter, msgs, 2); + if (ret == 2) + return 0; + + trace_i2cr_i2c_error(client, command, ret); + + if (ret < 0) + return ret; + + return -EIO; +} + +static int i2cr_check_status(struct i2c_client *client) +{ + u64 status; + int ret; + + ret = i2cr_transfer(client, I2CR_STATUS_CMD, &status); + if (ret) + return ret; + + if (status & I2CR_STATUS_ERR) { + u32 buf[3] = { 0, 0, 0 }; + u64 error; + u64 log; + + i2cr_transfer(client, I2CR_ERROR_CMD, &error); + i2cr_transfer(client, I2CR_LOG_CMD, &log); + + trace_i2cr_status_error(client, status, error, log); + + buf[0] = I2CR_STATUS_CMD; + i2c_master_send(client, (const char *)buf, sizeof(buf)); + + buf[0] = I2CR_ERROR_CMD; + i2c_master_send(client, (const char *)buf, sizeof(buf)); + + buf[0] = I2CR_LOG_CMD; + i2c_master_send(client, (const char *)buf, sizeof(buf)); + + dev_err(&client->dev, "status:%016llx error:%016llx log:%016llx\n", status, error, + log); + return -EREMOTEIO; + } + + trace_i2cr_status(client, status); + return 0; +} + +int fsi_master_i2cr_read(struct fsi_master_i2cr *i2cr, u32 addr, u64 *data) +{ + u32 command = i2cr_get_command(addr, I2CR_INITIAL_PARITY); + int ret; + + mutex_lock(&i2cr->lock); + + ret = i2cr_transfer(i2cr->client, command, data); + if (ret) + goto unlock; + + ret = i2cr_check_status(i2cr->client); + if (ret) + goto unlock; + + trace_i2cr_read(i2cr->client, command, data); + +unlock: + mutex_unlock(&i2cr->lock); + return ret; +} +EXPORT_SYMBOL_GPL(fsi_master_i2cr_read); + +int fsi_master_i2cr_write(struct fsi_master_i2cr *i2cr, u32 addr, u64 data) +{ + u32 buf[3] = { 0 }; + int ret; + + buf[0] = i2cr_get_command(addr, i2cr_check_parity64(data)); + memcpy(&buf[1], &data, sizeof(data)); + + mutex_lock(&i2cr->lock); + + ret = i2c_master_send(i2cr->client, (const char *)buf, sizeof(buf)); + if (ret == sizeof(buf)) { + ret = i2cr_check_status(i2cr->client); + if (!ret) + trace_i2cr_write(i2cr->client, buf[0], data); + } else { + trace_i2cr_i2c_error(i2cr->client, buf[0], ret); + + if (ret >= 0) + ret = -EIO; + } + + mutex_unlock(&i2cr->lock); + return ret; +} +EXPORT_SYMBOL_GPL(fsi_master_i2cr_write); + +static int i2cr_read(struct fsi_master *master, int link, uint8_t id, uint32_t addr, void *val, + size_t size) +{ + struct fsi_master_i2cr *i2cr = container_of(master, struct fsi_master_i2cr, master); + u64 data; + size_t i; + int ret; + + if (link || id || (addr & 0xffff0000) || !(size == 1 || size == 2 || size == 4)) + return -EINVAL; + + /* + * The I2CR doesn't have CFAM or FSI slave address space - only the + * engines. In order for this to work with the FSI core, we need to + * emulate at minimum the CFAM config table so that the appropriate + * engines are discovered. + */ + if (addr < 0xc00) { + if (addr > sizeof(i2cr_cfam) - 4) + addr = (addr & 0x3) + (sizeof(i2cr_cfam) - 4); + + memcpy(val, &i2cr_cfam[addr], size); + return 0; + } + + ret = fsi_master_i2cr_read(i2cr, I2CR_ADDRESS_CFAM(addr), &data); + if (ret) + return ret; + + /* + * FSI core expects up to 4 bytes BE back, while I2CR replied with LE + * bytes on the wire. + */ + for (i = 0; i < size; ++i) + ((u8 *)val)[i] = ((u8 *)&data)[7 - i]; + + return 0; +} + +static int i2cr_write(struct fsi_master *master, int link, uint8_t id, uint32_t addr, + const void *val, size_t size) +{ + struct fsi_master_i2cr *i2cr = container_of(master, struct fsi_master_i2cr, master); + u64 data = 0; + size_t i; + + if (link || id || (addr & 0xffff0000) || !(size == 1 || size == 2 || size == 4)) + return -EINVAL; + + /* I2CR writes to CFAM or FSI slave address are a successful no-op. */ + if (addr < 0xc00) + return 0; + + /* + * FSI core passes up to 4 bytes BE, while the I2CR expects LE bytes on + * the wire. + */ + for (i = 0; i < size; ++i) + ((u8 *)&data)[7 - i] = ((u8 *)val)[i]; + + return fsi_master_i2cr_write(i2cr, I2CR_ADDRESS_CFAM(addr), data); +} + +static void i2cr_release(struct device *dev) +{ + struct fsi_master_i2cr *i2cr = to_fsi_master_i2cr(to_fsi_master(dev)); + + of_node_put(dev->of_node); + + kfree(i2cr); +} + +static int i2cr_probe(struct i2c_client *client) +{ + struct fsi_master_i2cr *i2cr; + int ret; + + i2cr = kzalloc(sizeof(*i2cr), GFP_KERNEL); + if (!i2cr) + return -ENOMEM; + + /* Only one I2CR on any given I2C bus (fixed I2C device address) */ + i2cr->master.idx = client->adapter->nr; + dev_set_name(&i2cr->master.dev, "i2cr%d", i2cr->master.idx); + i2cr->master.dev.parent = &client->dev; + i2cr->master.dev.of_node = of_node_get(dev_of_node(&client->dev)); + i2cr->master.dev.release = i2cr_release; + + i2cr->master.n_links = 1; + i2cr->master.read = i2cr_read; + i2cr->master.write = i2cr_write; + + mutex_init(&i2cr->lock); + i2cr->client = client; + + ret = fsi_master_register(&i2cr->master); + if (ret) + return ret; + + i2c_set_clientdata(client, i2cr); + return 0; +} + +static void i2cr_remove(struct i2c_client *client) +{ + struct fsi_master_i2cr *i2cr = i2c_get_clientdata(client); + + fsi_master_unregister(&i2cr->master); +} + +static const struct of_device_id i2cr_ids[] = { + { .compatible = "ibm,i2cr-fsi-master" }, + { } +}; +MODULE_DEVICE_TABLE(of, i2cr_ids); + +static struct i2c_driver i2cr_driver = { + .probe_new = i2cr_probe, + .remove = i2cr_remove, + .driver = { + .name = "fsi-master-i2cr", + .of_match_table = i2cr_ids, + }, +}; + +module_i2c_driver(i2cr_driver) + +MODULE_AUTHOR("Eddie James "); +MODULE_DESCRIPTION("IBM I2C Responder virtual FSI master driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/fsi/fsi-master-i2cr.h b/drivers/fsi/fsi-master-i2cr.h new file mode 100644 index 000000000000..96636bf28cac --- /dev/null +++ b/drivers/fsi/fsi-master-i2cr.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright (C) IBM Corporation 2023 */ + +#ifndef DRIVERS_FSI_MASTER_I2CR_H +#define DRIVERS_FSI_MASTER_I2CR_H + +#include +#include + +#include "fsi-master.h" + +struct i2c_client; + +struct fsi_master_i2cr { + struct fsi_master master; + struct mutex lock; /* protect HW access */ + struct i2c_client *client; +}; + +#define to_fsi_master_i2cr(m) container_of(m, struct fsi_master_i2cr, master) + +int fsi_master_i2cr_read(struct fsi_master_i2cr *i2cr, u32 addr, u64 *data); +int fsi_master_i2cr_write(struct fsi_master_i2cr *i2cr, u32 addr, u64 data); + +static inline bool is_fsi_master_i2cr(struct fsi_master *master) +{ + if (master->dev.parent && master->dev.parent->type == &i2c_client_type) + return true; + + return false; +} + +#endif /* DRIVERS_FSI_MASTER_I2CR_H */ diff --git a/include/trace/events/fsi_master_i2cr.h b/include/trace/events/fsi_master_i2cr.h new file mode 100644 index 000000000000..c33eba130049 --- /dev/null +++ b/include/trace/events/fsi_master_i2cr.h @@ -0,0 +1,107 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM fsi_master_i2cr + +#if !defined(_TRACE_FSI_MASTER_I2CR_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_FSI_MASTER_I2CR_H + +#include + +TRACE_EVENT(i2cr_i2c_error, + TP_PROTO(const struct i2c_client *client, uint32_t command, int rc), + TP_ARGS(client, command, rc), + TP_STRUCT__entry( + __field(int, bus) + __field(int, rc) + __array(unsigned char, command, sizeof(uint32_t)) + __field(unsigned short, addr) + ), + TP_fast_assign( + __entry->bus = client->adapter->nr; + __entry->rc = rc; + memcpy(__entry->command, &command, sizeof(uint32_t)); + __entry->addr = client->addr; + ), + TP_printk("%d-%02x command:{ %*ph } rc:%d", __entry->bus, __entry->addr, + (int)sizeof(uint32_t), __entry->command, __entry->rc) +); + +TRACE_EVENT(i2cr_read, + TP_PROTO(const struct i2c_client *client, uint32_t command, uint64_t *data), + TP_ARGS(client, command, data), + TP_STRUCT__entry( + __field(int, bus) + __array(unsigned char, data, sizeof(uint64_t)) + __array(unsigned char, command, sizeof(uint32_t)) + __field(unsigned short, addr) + ), + TP_fast_assign( + __entry->bus = client->adapter->nr; + memcpy(__entry->data, data, sizeof(uint64_t)); + memcpy(__entry->command, &command, sizeof(uint32_t)); + __entry->addr = client->addr; + ), + TP_printk("%d-%02x command:{ %*ph } { %*ph }", __entry->bus, __entry->addr, + (int)sizeof(uint32_t), __entry->command, (int)sizeof(uint64_t), __entry->data) +); + +TRACE_EVENT(i2cr_status, + TP_PROTO(const struct i2c_client *client, uint64_t status), + TP_ARGS(client, status), + TP_STRUCT__entry( + __field(uint64_t, status) + __field(int, bus) + __field(unsigned short, addr) + ), + TP_fast_assign( + __entry->status = status; + __entry->bus = client->adapter->nr; + __entry->addr = client->addr; + ), + TP_printk("%d-%02x %016llx", __entry->bus, __entry->addr, __entry->status) +); + +TRACE_EVENT(i2cr_status_error, + TP_PROTO(const struct i2c_client *client, uint64_t status, uint64_t error, uint64_t log), + TP_ARGS(client, status, error, log), + TP_STRUCT__entry( + __field(uint64_t, error) + __field(uint64_t, log) + __field(uint64_t, status) + __field(int, bus) + __field(unsigned short, addr) + ), + TP_fast_assign( + __entry->error = error; + __entry->log = log; + __entry->status = status; + __entry->bus = client->adapter->nr; + __entry->addr = client->addr; + ), + TP_printk("%d-%02x status:%016llx error:%016llx log:%016llx", __entry->bus, __entry->addr, + __entry->status, __entry->error, __entry->log) +); + +TRACE_EVENT(i2cr_write, + TP_PROTO(const struct i2c_client *client, uint32_t command, uint64_t data), + TP_ARGS(client, command, data), + TP_STRUCT__entry( + __field(int, bus) + __array(unsigned char, data, sizeof(uint64_t)) + __array(unsigned char, command, sizeof(uint32_t)) + __field(unsigned short, addr) + ), + TP_fast_assign( + __entry->bus = client->adapter->nr; + memcpy(__entry->data, &data, sizeof(uint64_t)); + memcpy(__entry->command, &command, sizeof(uint32_t)); + __entry->addr = client->addr; + ), + TP_printk("%d-%02x command:{ %*ph } { %*ph }", __entry->bus, __entry->addr, + (int)sizeof(uint32_t), __entry->command, (int)sizeof(uint64_t), __entry->data) +); + +#endif + +#include From patchwork Mon Jun 12 19:56:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 106790 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp102037vqr; Mon, 12 Jun 2023 13:00:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ50usOqToatBKSxezmxMyOj2+wOxFEJtAcvNYKpVNXslLrQZUUahlK+4SpU/5UwaHthByH5 X-Received: by 2002:a17:907:7f93:b0:974:218d:c048 with SMTP id qk19-20020a1709077f9300b00974218dc048mr12503257ejc.26.1686600049540; Mon, 12 Jun 2023 13:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686600049; cv=none; d=google.com; s=arc-20160816; b=Tc2XRiMZEuG5LoYoHWuJSvoOQetSPQC0B8NkFZr+xU149q5fo3cBNUEpbywddiFMBN Bk6CejfMYG1iRpVOM9FIzDaGXq5WsJp7EC8Q0hPNaF/czAzyHAct+aAn/d18IhRWQqV0 hDmqA1LNgEoyMSd9nkSrrfXx73GOMk1rZfK7gAHeqPUujs4iemNwKcM6Hu+QXvtqAleC 9hVzx5k1wtLctc8hug7npFamVu2691TQsIkUHECqgXEy+0FCfkJx/kiOyETugwXqqHak TZKtZb0bOjJ6na1hAb70FG85Qd340b+l35N/a+OEfcXiNbuV62P7DQ7s4q85f3hzArHx x8Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=M5sEvBBCcKHBbmC45TNh3NfbOdkfuoDAjydAI0t3/10=; b=YTtecHBV6ps5db654Y1GLWWb1Tk/fmExd+23JWM7LtfQZMIZZAk/NjyTi/dldkPfG3 AffNkiqxLjuWBi1f94ESO3IkCMl5AuXcgCwoofczU6CFKX++xE9cHTwXSlnF2nEdF0GU a7e/Q6yB8LAcm4bPOLaVPmCBOncWmAcBdZ7M9kMKIU/PCtVFhej+e5Y4Rs7w547Y9+5J JXwEdcSXT1rQWEllbmk3uFhLdNke1NbHnYNl0M8nWJg8miOgDS1Uz5rVU4DIEcTv1f8q 4PSU+/B+OSayQruFTvRxCKYanKjhsBlJElrj3hGnQ5ZuYgj01aLNFAmlQlMAI1CHh4E1 V5qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=p4ls+LAT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t18-20020a170906179200b0096b1c38458dsi5960279eje.409.2023.06.12.13.00.24; Mon, 12 Jun 2023 13:00:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=p4ls+LAT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237970AbjFLT52 (ORCPT + 99 others); Mon, 12 Jun 2023 15:57:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231867AbjFLT5S (ORCPT ); Mon, 12 Jun 2023 15:57:18 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B90A10D3; Mon, 12 Jun 2023 12:57:17 -0700 (PDT) Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJl1vt005313; Mon, 12 Jun 2023 19:57:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=M5sEvBBCcKHBbmC45TNh3NfbOdkfuoDAjydAI0t3/10=; b=p4ls+LATtwjIYZz2NkhVVk0WfmI+vcgaV5BZD1dd0zBoVkzs25ly5zQotmUw4h552fow z/7ZcH7Z9JPSvjNwRzixgx75STXN8K4m9GjE/dSinSSDZ1VCaF48v/+ynHely7XdoQ+O cpycNZ7iliIh5kdP/6OiPOrvBzSKzAz1bFStNRnpBaESkscIjPLDIdJRihX9mqqiP8N8 S22Kt0rzhRAwHmXNmYwICBgHZ8WWO5KTmy1Or1tP5Inxx5hBX2j4Cp9VR2MSf3OQLPbQ GQS8jKFwNLFofGc1W7LtEYxuppNyvkivS0Wq8VLabV46ylKzJ52HTDkkzcuBVsitklsR Xg== Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r69tqg669-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:04 +0000 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35CJ52kl011883; Mon, 12 Jun 2023 19:57:04 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([9.208.130.102]) by ppma04dal.us.ibm.com (PPS) with ESMTPS id 3r4gt5krsk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Jun 2023 19:57:03 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35CJv2am57737700 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jun 2023 19:57:02 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B33705805D; Mon, 12 Jun 2023 19:57:02 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 771FB58059; Mon, 12 Jun 2023 19:57:02 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.148.226]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Jun 2023 19:57:02 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, andrew@aj.id.au, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org Subject: [PATCH 14/14] fsi: Add I2C Responder SCOM driver Date: Mon, 12 Jun 2023 14:56:57 -0500 Message-Id: <20230612195657.245125-15-eajames@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230612195657.245125-1-eajames@linux.ibm.com> References: <20230612195657.245125-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ATc1AAoVNKi_oSJXY4FtOB6okzHinYLG X-Proofpoint-GUID: ATc1AAoVNKi_oSJXY4FtOB6okzHinYLG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-12_14,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 impostorscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 spamscore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 adultscore=0 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306120169 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768528333172018694?= X-GMAIL-MSGID: =?utf-8?q?1768528333172018694?= The I2CR has the capability to directly perform SCOM operations, circumventing the need to drive the FSI2PIB engine. Add a new driver to perform SCOM operations through the I2CR. Signed-off-by: Eddie James --- drivers/fsi/Kconfig | 8 +++ drivers/fsi/Makefile | 1 + drivers/fsi/i2cr-scom.c | 154 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+) create mode 100644 drivers/fsi/i2cr-scom.c diff --git a/drivers/fsi/Kconfig b/drivers/fsi/Kconfig index 999be82720c5..79a31593618a 100644 --- a/drivers/fsi/Kconfig +++ b/drivers/fsi/Kconfig @@ -94,4 +94,12 @@ config FSI_OCC provide the raw sensor data as well as perform thermal and power management on the system. +config I2CR_SCOM + tristate "IBM I2C Responder SCOM driver" + depends on FSI_MASTER_I2CR + help + This option enables an I2C Responder based SCOM device driver. The + I2CR has the capability to directly perform SCOM operations instead + of using the FSI2PIB engine. + endif diff --git a/drivers/fsi/Makefile b/drivers/fsi/Makefile index 34dbaa1c452e..5550aa15e0b1 100644 --- a/drivers/fsi/Makefile +++ b/drivers/fsi/Makefile @@ -9,3 +9,4 @@ obj-$(CONFIG_FSI_MASTER_AST_CF) += fsi-master-ast-cf.o obj-$(CONFIG_FSI_SCOM) += fsi-scom.o obj-$(CONFIG_FSI_SBEFIFO) += fsi-sbefifo.o obj-$(CONFIG_FSI_OCC) += fsi-occ.o +obj-$(CONFIG_I2CR_SCOM) += i2cr-scom.o diff --git a/drivers/fsi/i2cr-scom.c b/drivers/fsi/i2cr-scom.c new file mode 100644 index 000000000000..cb7e02213032 --- /dev/null +++ b/drivers/fsi/i2cr-scom.c @@ -0,0 +1,154 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) IBM Corporation 2023 */ + +#include +#include +#include +#include +#include +#include + +#include "fsi-master-i2cr.h" +#include "fsi-slave.h" + +struct i2cr_scom { + struct device dev; + struct cdev cdev; + struct fsi_master_i2cr *i2cr; +}; + +static loff_t i2cr_scom_llseek(struct file *file, loff_t offset, int whence) +{ + switch (whence) { + case SEEK_CUR: + break; + case SEEK_SET: + file->f_pos = offset; + break; + default: + return -EINVAL; + } + + return offset; +} + +static ssize_t i2cr_scom_read(struct file *filep, char __user *buf, size_t len, loff_t *offset) +{ + struct i2cr_scom *scom = filep->private_data; + u64 data; + int ret; + + if (len != sizeof(data)) + return -EINVAL; + + ret = fsi_master_i2cr_read(scom->i2cr, (u32)*offset, &data); + if (ret) + return ret; + + ret = copy_to_user(buf, &data, len); + if (ret) + return ret; + + return len; +} + +static ssize_t i2cr_scom_write(struct file *filep, const char __user *buf, size_t len, + loff_t *offset) +{ + struct i2cr_scom *scom = filep->private_data; + u64 data; + int ret; + + if (len != sizeof(data)) + return -EINVAL; + + ret = copy_from_user(&data, buf, len); + if (ret) + return ret; + + ret = fsi_master_i2cr_write(scom->i2cr, (u32)*offset, data); + if (ret) + return ret; + + return len; +} + +static const struct file_operations i2cr_scom_fops = { + .owner = THIS_MODULE, + .open = simple_open, + .llseek = i2cr_scom_llseek, + .read = i2cr_scom_read, + .write = i2cr_scom_write, +}; + +static int i2cr_scom_probe(struct device *dev) +{ + struct fsi_device *fsi_dev = to_fsi_dev(dev); + struct i2cr_scom *scom; + int didx; + int ret; + + if (!is_fsi_master_i2cr(fsi_dev->slave->master)) + return -ENODEV; + + scom = devm_kzalloc(dev, sizeof(*scom), GFP_KERNEL); + if (!scom) + return -ENOMEM; + + scom->i2cr = to_fsi_master_i2cr(fsi_dev->slave->master); + dev_set_drvdata(dev, scom); + + scom->dev.type = &fsi_cdev_type; + scom->dev.parent = dev; + device_initialize(&scom->dev); + + ret = fsi_get_new_minor(fsi_dev, fsi_dev_scom, &scom->dev.devt, &didx); + if (ret) + return ret; + + dev_set_name(&scom->dev, "scom%d", didx); + cdev_init(&scom->cdev, &i2cr_scom_fops); + ret = cdev_device_add(&scom->cdev, &scom->dev); + if (ret) + fsi_free_minor(scom->dev.devt); + + return ret; +} + +static int i2cr_scom_remove(struct device *dev) +{ + struct i2cr_scom *scom = dev_get_drvdata(dev); + + cdev_device_del(&scom->cdev, &scom->dev); + fsi_free_minor(scom->dev.devt); + + return 0; +} + +static const struct of_device_id i2cr_scom_of_ids[] = { + { .compatible = "ibm,i2cr-scom" }, + { } +}; +MODULE_DEVICE_TABLE(of, i2cr_scom_of_ids); + +static const struct fsi_device_id i2cr_scom_ids[] = { + { 0x5, FSI_VERSION_ANY }, + { } +}; + +static struct fsi_driver i2cr_scom_driver = { + .id_table = i2cr_scom_ids, + .drv = { + .name = "i2cr_scom", + .bus = &fsi_bus_type, + .of_match_table = i2cr_scom_of_ids, + .probe = i2cr_scom_probe, + .remove = i2cr_scom_remove, + } +}; + +module_fsi_driver(i2cr_scom_driver); + +MODULE_AUTHOR("Eddie James "); +MODULE_DESCRIPTION("IBM I2C Responder SCOM driver"); +MODULE_LICENSE("GPL");