From patchwork Thu Feb 15 22:07:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201776 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp150958dyb; Thu, 15 Feb 2024 14:09:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV/+FvThLgcZqcNmzbYLu3ng5mCWoidV67LAozYhfr0h25oSbV60Ax3sIPJVAUqIpel26uh8a+3iwm4qEMQOBGhO9lY1Q== X-Google-Smtp-Source: AGHT+IFFgujUJAtZ+7/IN4fJ+BNrdgJ2Qh5l20J4iU4fr12imds4xNhlHnFI4fNfc6QxhVVny8/a X-Received: by 2002:a0c:dd12:0:b0:68f:20b0:5b27 with SMTP id u18-20020a0cdd12000000b0068f20b05b27mr2239308qvk.17.1708034985869; Thu, 15 Feb 2024 14:09:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708034985; cv=pass; d=google.com; s=arc-20160816; b=Dc5P/L7Z2GMyB+FlE38C6+2quMu9KFgnEfwjy/ey2xOXRQrdMbh3AK6a9t+jLBGW3b qBdL5R2ihgIui6W65TKbXDMFpFrdLh1pgpc5klESdlZD91LtomnifkrvjWG+fa3u+Pxm OEzsfaMlKoUWdXjwxbfQjP/TIs4ZYVNF/r77t10v/Ma0x0mb5aDHCXhsNH+a+wScT/hn uY7oSaS5QKDhFymuK8kRjFZq57S2LwjsjyTOjKZ7t7ZXzYJxet1ZTHHn6Mb+GD0vmynl y2e8c0Jvyn21R+QRxuLz0ESemA7XyyWxsI+74nv4Fki+9AW0PEnomUNWTzzYf79z7QYd izfQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=P8OGdQzF+B4wDwOCmtPA8O26OLGEvB+HLASD00ktc4E=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=P6J2YrfEwhcEXb2d6pnKBCT6rpFfdd9nPEJhC0+P7ySek2MRTZ/vSkHDGOm8s578w8 ycFskuQWw1q3HgMk/v/1DVYYu2ReMlcuZGrHAIZp0JiTfFePPWkQsg+eWL4IR0Gwk0m8 FBzKvRpJlCod5YAYHStSHCO9rDiN0Rn9WqJEERpLor1vavr/MO6R7fzApMKMRQwI0OPp 92cqSJ/oJJH9EHKVThTVzuw72zUmwUzFCdJXI4WNC/nSc3koRqV36w6g5OszK1Mo+ZUg nAenBmoAo0FjeJM1yj/5r1JIDfiAKHmBBhon4QslgMjN5hRlbTUqxUR4ot+RSdFTgnS1 8zyw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=swLUlPbk; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67737-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67737-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t6-20020a0562140c6600b0068c7251fe66si2381851qvj.568.2024.02.15.14.09.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:09:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67737-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=swLUlPbk; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67737-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67737-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 885A01C2119D for ; Thu, 15 Feb 2024 22:09:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E46A146905; Thu, 15 Feb 2024 22:08:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="swLUlPbk" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CAB651420D2; Thu, 15 Feb 2024 22:08:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034904; cv=none; b=YPxWmiT5QGsuXLj7JlgmQnAS0MmpZR9ebNZocDJZ0rTavD7xvdiJUDmVT05bk6asjrUXwO84pkf+COfGCfq2ADjWh4GtkvXN3pcLlEMCe/8+oGjV3Ew3RAJ3Ngqzc1DLqePPWxHgMZAwW27mpAmpolnm2maxkxeOBz3rIfelyWc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034904; c=relaxed/simple; bh=n4sfwcjdd4ijA4oa4X7pSA+P2/QVFgg6UaNkyPLZVrY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ebcs/x/f1Up44qx3VZ0KCKls3obMC7rd2Qx4Xpu22oihlaLAZ+r/cc7H5rI700cqnZLiMg4bTmeTDFvLS+W46aGBb6hpU+QXo1017qSmRVM3whZ2W2UH1iL6rQfRdyj7rqg4lnOlnZEGym6iHcc26cuDjP4NwWAVT/Z92i64LB4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=swLUlPbk; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41FK1Sgd029531; Thu, 15 Feb 2024 22:08:06 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=P8OGdQzF+B4wDwOCmtPA8O26OLGEvB+HLASD00ktc4E=; b=swLUlPbkz3iebXl370Ra73xHEDZ9H9jVfsxzv+XsBF599FAqDygLtr6xp+qVjfx2IpAP DXZgMiaDkxpkZQLONkLkty6bmbyQe4hAMhB0MC9fAGy0e1BI8aEBxQMoZ5PBGwGmdFeR /HCqHHto4olAAOAm4IFNxYhZun5GgpU7PvuEKKFyK8nipfBr/UB/uax+G5V7s9FCfCqs ZNUnOMu9hqyVKhcKWGXgNaujgFnpNgGxAoEFdcmnF3fRI8yrckZH3MakkVxFdcCPVuAQ KEpxFRLju+3ax50aU3wkOZ1JipFFUK1NH7Ez+Oioq4T/pf8RGrnW8RH7MNERUYceBuLj 8Q== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9q0v5y9f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:06 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FJvSdj016307; Thu, 15 Feb 2024 22:08:05 GMT Received: from smtprelay05.wdc07v.mail.ibm.com ([172.16.1.72]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6mymyhbr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:05 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM82L034865450 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:04 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6450158071; Thu, 15 Feb 2024 22:08:02 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 10D705806F; Thu, 15 Feb 2024 22:08:02 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:02 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 01/33] dt-bindings: clock: ast2600: Add FSI clock Date: Thu, 15 Feb 2024 16:07:27 -0600 Message-Id: <20240215220759.976998-2-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: mXZ_5paJfw486B07y6yz4b9YLiZjx165 X-Proofpoint-GUID: mXZ_5paJfw486B07y6yz4b9YLiZjx165 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 suspectscore=0 phishscore=0 mlxlogscore=968 clxscore=1011 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004493242137289 X-GMAIL-MSGID: 1791004493242137289 Add a definition for the FSI clock. Signed-off-by: Eddie James Acked-by: Krzysztof Kozlowski --- include/dt-bindings/clock/ast2600-clock.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/dt-bindings/clock/ast2600-clock.h b/include/dt-bindings/clock/ast2600-clock.h index 712782177c90..7ae96c7bd72f 100644 --- a/include/dt-bindings/clock/ast2600-clock.h +++ b/include/dt-bindings/clock/ast2600-clock.h @@ -86,6 +86,7 @@ #define ASPEED_CLK_MAC3RCLK 69 #define ASPEED_CLK_MAC4RCLK 70 #define ASPEED_CLK_I3C 71 +#define ASPEED_CLK_FSI 72 /* Only list resets here that are not part of a clock gate + reset pair */ #define ASPEED_RESET_ADC 55 From patchwork Thu Feb 15 22:07:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201808 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp159432dyb; Thu, 15 Feb 2024 14:29:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWK0OFZGRIiNuMrODPwdeR60sT0Va40sX005SmDxXdFjEhSz+BUDj2UhKcDkNd0k9nhBUIcE7gA9M8JXb2qosL/QDEoLQ== X-Google-Smtp-Source: AGHT+IFqUcCV8ylB36qPPh8UGZkeNvPiU3t7Qb45TNen3HxSu7OCjF7RPw53gAkUxyMj/nX/aMqi X-Received: by 2002:a05:6a00:23cc:b0:6e1:1cef:3aa6 with SMTP id g12-20020a056a0023cc00b006e11cef3aa6mr4064535pfc.23.1708036170360; Thu, 15 Feb 2024 14:29:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708036170; cv=pass; d=google.com; s=arc-20160816; b=D+0Q4uWjeH3tVp2YYQsGKhOCprsbW26Zf2nKQoGCryaaSNP2ocwptrG2YFyNKwAtoc /iCLj3xbxj/Iuz0pUL0kssG58fZvKwwv2pzBD4B8oHaalrGamES85SEbztEiOsvGVtrK 0Qae8JcIdGwIE2AyRehmmsatrncodOc0h1A6oy3IAOyVt3xVtGu9FP+43Tf5T5SUzz7o EgTbzs/vfipe8L9GrmdZ5XtieblZaHRc6mDB+8Z0b0H7omiVTWs/HyMpuzwVq2x0Fio+ N6UCtQOJVfpI7kGuEMJHScKglpLaSvzzyWWW3F/vk/k9JylOyd1mjf7zXXFPTxNFXzAy ds1A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xd7lrsen2it77yQmo7Ql0gP9UsW8IXDRnS5i0NzUgnI=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=gxwut8tS4GjrMsyAZDg/VQSfwtXP9kU5C2ILQmetbscNDbK+MD4cM4CPw5j0+M2FcY 14PTpmgQuRHm1yK9BL9q+qgV4+R4usWuxMJ72jgWgs6Wj7TOP7gf+pCO9OjXcSH+bNJN bH+gbkmS/VK2l9wjk3xBmW4Mqn07B/WC1M+WVWkBRdpKWx/Hydq+NWpEaA0AafN4U8lF 54c5gtgUGb7D+31dOEgGHBldLvB3arSRKmHF/buYvYuLf3Xbn17RTZ0VzvniAIdHOA/t B35G9MpppPF5vnOvPGfCepEe+f8eGmiaTHnR1BoZE8DpnxygA2puZujVCLthA92Nj88h cnGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=idf+UuKk; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67765-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67765-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d127-20020a633685000000b005dc6295d185si1828032pga.495.2024.02.15.14.29.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:29:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67765-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=idf+UuKk; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67765-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67765-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 85DBDB26620 for ; Thu, 15 Feb 2024 22:17:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F0BDC14534D; Thu, 15 Feb 2024 22:08:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="idf+UuKk" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EE2C151CC6; Thu, 15 Feb 2024 22:08:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034919; cv=none; b=eoBxFxruQUV+xU3FC99/ugGuVX/IZoNA1+d4ceKJnuzsIlQlO3j/7LXqS4JyXJ7dZHKD1kUoudFydRQpn9Tr4Bn0Yg0MjEbZpbbc3CvfLFPXdFwpBD7Jzs48tiMv4iRUzZjlX8Nf62Gr/a3unwMise5bzN4/VczFmbAmUuOanIk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034919; c=relaxed/simple; bh=lblN2MxrNHftFgMgHVzLgv+0vLc3TPzvtG1g+PjEmhs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZzAZuzqq982DrX5k/kRX/bY7PKETS9wrxWr9pwFFHyKiMyRzfATWEtwOLtdViA+dc1EfsaDCuBhGXqZAg3OehBKt5DUzk468zBENNDyeH5KkEItdU3BTLG6EnKeZ9kOpRru7BL6ZY/lBm/MGvGKgfLcxdQUX+DXRodyWOTYYweA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=idf+UuKk; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLX1AO019281; Thu, 15 Feb 2024 22:08:09 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=xd7lrsen2it77yQmo7Ql0gP9UsW8IXDRnS5i0NzUgnI=; b=idf+UuKkauTb1zwU63vMpUta0cjhC50VLLdP8iR5kWnep3iuKeUJJU2evqtEwBy7EiUT eC3B1BwEC3Pv6AtXyfXnrvr3gQQAKFedcypris9f/Mtc0oBvGWIKEPjBmhwGJgtveLZu v4Lgt4nto1wJNeqoFn/umcvztNZNRlZfAFkgxOVqQRdCzoMzDvb6p7feYGYf69KJ5axD 8bVNKCaDZ3QIvQUZAD+GRfw6JyJs+hTUX5Xu5/YHDfSumtzyBBgE+16LazpcluTHlcrU h+fiGxL24rR0QYhiDxF0j3phHSr5q2qO8d9mZMWHh/gZOAcHGj3x7pBf3BWMo9EcBMoa kQ== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9tmf8mx8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:08 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLKApd010063; Thu, 15 Feb 2024 22:08:08 GMT Received: from smtprelay05.wdc07v.mail.ibm.com ([172.16.1.72]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6npm7811-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:07 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM844v34865452 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:07 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AF2725807A; Thu, 15 Feb 2024 22:08:02 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6CEAC58072; Thu, 15 Feb 2024 22:08:02 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:02 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 02/33] clk: ast2600: Add FSI parent clock with correct rate Date: Thu, 15 Feb 2024 16:07:28 -0600 Message-Id: <20240215220759.976998-3-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: qu9m3EEKVKG-DGbpYkJKjIZdu1nYUI1H X-Proofpoint-ORIG-GUID: qu9m3EEKVKG-DGbpYkJKjIZdu1nYUI1H X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791005735321119944 X-GMAIL-MSGID: 1791005735321119944 In order to calculate correct FSI bus clocks, the FSI clock must correctly calculate the rate from the parent (APLL / 4). Signed-off-by: Eddie James --- drivers/clk/clk-ast2600.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c index 909c3137c428..faf88324f7b1 100644 --- a/drivers/clk/clk-ast2600.c +++ b/drivers/clk/clk-ast2600.c @@ -19,7 +19,7 @@ * This includes the gates (configured from aspeed_g6_gates), plus the * explicitly-configured clocks (ASPEED_CLK_HPLL and up). */ -#define ASPEED_G6_NUM_CLKS 72 +#define ASPEED_G6_NUM_CLKS 73 #define ASPEED_G6_SILICON_REV 0x014 #define CHIP_REVISION_ID GENMASK(23, 16) @@ -157,7 +157,7 @@ static const struct aspeed_gate_data aspeed_g6_gates[] = { [ASPEED_CLK_GATE_UART11CLK] = { 59, -1, "uart11clk-gate", "uartx", 0 }, /* UART11 */ [ASPEED_CLK_GATE_UART12CLK] = { 60, -1, "uart12clk-gate", "uartx", 0 }, /* UART12 */ [ASPEED_CLK_GATE_UART13CLK] = { 61, -1, "uart13clk-gate", "uartx", 0 }, /* UART13 */ - [ASPEED_CLK_GATE_FSICLK] = { 62, 59, "fsiclk-gate", NULL, 0 }, /* FSI */ + [ASPEED_CLK_GATE_FSICLK] = { 62, 59, "fsiclk-gate", "fsiclk", 0 }, /* FSI */ }; static const struct clk_div_table ast2600_eclk_div_table[] = { @@ -821,6 +821,9 @@ static void __init aspeed_g6_cc(struct regmap *map) hw = clk_hw_register_fixed_factor(NULL, "i3cclk", "apll", 0, 1, 8); aspeed_g6_clk_data->hws[ASPEED_CLK_I3C] = hw; + + hw = clk_hw_register_fixed_factor(NULL, "fsiclk", "apll", 0, 1, 4); + aspeed_g6_clk_data->hws[ASPEED_CLK_FSI] = hw; }; static void __init aspeed_g6_cc_init(struct device_node *np) From patchwork Thu Feb 15 22:07:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201789 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp153232dyb; Thu, 15 Feb 2024 14:14:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVUKtWsQ9XPPSvvwB066kAZaggJJcJbpGH/iHBEeFp+rk4681c6EiWeuoPrkVCi2Y40jnkNgZb02Nj2Zv4IAzuGOUoEeA== X-Google-Smtp-Source: AGHT+IGsMIAUwL6zrDll9GZCp544F3gKecA2InLsKgBt1S77czZS7B9heRGp/qpu3zj4reVEAs5t X-Received: by 2002:a17:90b:3107:b0:298:bc6a:7849 with SMTP id gc7-20020a17090b310700b00298bc6a7849mr3099590pjb.32.1708035294157; Thu, 15 Feb 2024 14:14:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035294; cv=pass; d=google.com; s=arc-20160816; b=p/2uy4Y0Ktoz6F7gS8SPiVqOpuXm0pfQCdjeN+O81e4y9WYMjNxbpiqBjA3aB0Q5b7 hS/crb418/hp1SgnamM6ustdkhBASpCeZJ5OPlfbgjQS1uUaDC1AQh3+HUrsikFdBEC5 S6W2M/J90GnvKJeqJHRvbOfR+zTf8MUF202oHcgRofEzI1FyDW/atng7N63pAW69iFe7 TsRtZB/59ky1tisuTN/CsueAqp716LERxo8S1/lMDMwzQqb0mI5aFwTslvhMGjwboK9J ZoQixnyRsifdI1bors8cIsaY96Nz7iHtZ0Qc+7mDQZJ1RcMKRoZdq4hmg8STP8hIFU6p WCaQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=EzykbgY8VklP3b8xENMmzzAd8qt59mCClFOsxoemn6M=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=j1mXvqsfETYzHov4thTIC0RaMeZgIwpj5vbvzetr8D5pdmkjPTljewkH9wxC5cVTem OaAdtBZ8V8E82PNpNGt5AqRaYHvK+dNikWhd4GOk0U1nfg0/oEf/86hsL1cLTT4at/gW b2qk52n0y42WLm5NaQVxiTEDhQplyX6g1Z9+7Fva6mz629jtMCEDpvt4FtzzSyip8z5Z tIA4mBpxQo6IyWrphBrQSjiP7nPLsTcBElh1TDHN6a3skAKrg8mGbMB8DfA3bR6glCHa hD0GDfjoTDfR1FqBBw9BNjKlEZMr3JQdqWUdmdJCWHY9iv3dJHAz67SBq/CXtHrCABCA e3UQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=QGLYCAQm; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67735-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67735-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id cv11-20020a17090afd0b00b002960e6f9232si3591576pjb.122.2024.02.15.14.14.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:14:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67735-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=QGLYCAQm; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67735-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67735-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D33F7B23EA5 for ; Thu, 15 Feb 2024 22:09:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A699146918; Thu, 15 Feb 2024 22:08:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="QGLYCAQm" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CAB1B1420D1; Thu, 15 Feb 2024 22:08:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034903; cv=none; b=g3bikaZQVssrvTofMbfzzQAI+a+wMrG85hVPi+HZ9JuOb8ZbMYQ9ztBu19DuXZ4Nkj5z3dXoiBezBuhjpDmcWacgfOv8/dzPAOcH6B7SlqoQcFMpEx75XOf5l8CwgEfkcHCYlJia2vA64mRTPiv8b2ka3MAMki5W8l9isieh/ec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034903; c=relaxed/simple; bh=riOdEpyj6YoR7dLCa84jfGwhhYRmIX3Tq7kzf7ULdVA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IgOWzwiPMl4jch0du0gIm+hl62eDPHQAJILiyvJwWfrVhhQb87BcGuKV4BFCRz3i/3F8aTUQtPWDD4FAkLkubYkSprq4tNbL/fHBoDxuhtBzmgnS/tMVVL2PZJwmKwrFyAZpVoz8539geoLEZCbUBhR+ztNuTZElzJzSomn4eyw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=QGLYCAQm; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FM27QG029947; Thu, 15 Feb 2024 22:08:07 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=EzykbgY8VklP3b8xENMmzzAd8qt59mCClFOsxoemn6M=; b=QGLYCAQmpDLoAJrB7S0WWQpFejEON6WyLZelVZ879SymIIXdae1KHvZAlAKWOPr4+szW vYePJO9dNBXf6XmkzDh7SdGfuERMg4xXPzvTTfeFkaHTYdBrpWHXbTCHiXwf9KlNvfjG etwwc2gt3rB5LW85oY9evMxU2hk0qpKfEc+McfKlvdbWC05YAOgKGjd90lPAsl/5OqYC 46KsI3JhTda7OizEalS1N+UZ69HfGUEV3Er6I6vt5wSITdcc9jiyjZEwGG25KBOEK26c 3OmPdNeiBVi0by+qGAMtfos6TPouWqrRyYDljNI8UgWKP0g91mv9e3n4Mtn0bWbymgET jw== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9s0tjy2k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:07 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLefR7032614; Thu, 15 Feb 2024 22:08:06 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6kftyud7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:06 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM83IT19727000 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:05 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1625258060; Thu, 15 Feb 2024 22:08:03 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BF8AD5803F; Thu, 15 Feb 2024 22:08:02 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:02 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 03/33] fsi: Move slave definitions to fsi-slave.h Date: Thu, 15 Feb 2024 16:07:29 -0600 Message-Id: <20240215220759.976998-4-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: YUZ5q9RnUGEB2EzKJCuk8rfcczQT5q2P X-Proofpoint-ORIG-GUID: YUZ5q9RnUGEB2EzKJCuk8rfcczQT5q2P X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 clxscore=1015 suspectscore=0 phishscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004816652705645 X-GMAIL-MSGID: 1791004816652705645 Master drivers may need access to the slave definitions. Signed-off-by: Eddie James --- drivers/fsi/fsi-core.c | 35 ----------------- drivers/fsi/fsi-slave.h | 84 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 35 deletions(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 097d5a780264..7bf0c96fc017 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -45,41 +45,6 @@ static const int engine_page_size = 0x400; -#define FSI_SLAVE_BASE 0x800 - -/* - * FSI slave engine control register offsets - */ -#define FSI_SMODE 0x0 /* R/W: Mode register */ -#define FSI_SISC 0x8 /* R/W: Interrupt condition */ -#define FSI_SSTAT 0x14 /* R : Slave status */ -#define FSI_SLBUS 0x30 /* W : LBUS Ownership */ -#define FSI_LLMODE 0x100 /* R/W: Link layer mode register */ - -/* - * SMODE fields - */ -#define FSI_SMODE_WSC 0x80000000 /* Warm start done */ -#define FSI_SMODE_ECRC 0x20000000 /* Hw CRC check */ -#define FSI_SMODE_SID_SHIFT 24 /* ID shift */ -#define FSI_SMODE_SID_MASK 3 /* ID Mask */ -#define FSI_SMODE_ED_SHIFT 20 /* Echo delay shift */ -#define FSI_SMODE_ED_MASK 0xf /* Echo delay mask */ -#define FSI_SMODE_SD_SHIFT 16 /* Send delay shift */ -#define FSI_SMODE_SD_MASK 0xf /* Send delay mask */ -#define FSI_SMODE_LBCRR_SHIFT 8 /* Clk ratio shift */ -#define FSI_SMODE_LBCRR_MASK 0xf /* Clk ratio mask */ - -/* - * SLBUS fields - */ -#define FSI_SLBUS_FORCE 0x80000000 /* Force LBUS ownership */ - -/* - * LLMODE fields - */ -#define FSI_LLMODE_ASYNC 0x1 - #define FSI_SLAVE_SIZE_23b 0x800000 static DEFINE_IDA(master_ida); diff --git a/drivers/fsi/fsi-slave.h b/drivers/fsi/fsi-slave.h index 1d63a585829d..dba65bd4e083 100644 --- a/drivers/fsi/fsi-slave.h +++ b/drivers/fsi/fsi-slave.h @@ -7,6 +7,90 @@ #include #include +#define FSI_SLAVE_BASE 0x800 + +/* + * FSI slave engine control register offsets + */ +#define FSI_SMODE 0x0 /* R/W: Mode register */ +#define FSI_SISC 0x8 /* R : Interrupt condition */ +#define FSI_SCISC 0x8 /* C : Clear interrupt condition */ +#define FSI_SISM 0xc /* R/W: Interrupt mask */ +#define FSI_SISS 0x10 /* R : Interrupt status */ +#define FSI_SSISM 0x10 /* S : Set interrupt mask */ +#define FSI_SCISM 0x14 /* C : Clear interrupt mask */ +#define FSI_SSTAT 0x14 /* R : Slave status */ +#define FSI_SI1S 0x1c /* R : Slave interrupt 1 status */ +#define FSI_SSI1M 0x1c /* S : Set slave interrupt 1 mask */ +#define FSI_SCI1M 0x20 /* C : Clear slave interrupt 1 mask */ +#define FSI_SLBUS 0x30 /* W : LBUS Ownership */ +#define FSI_SRSIC0 0x68 /* C : Clear remote interrupt condition */ +#define FSI_SRSIC4 0x6c /* C : Clear remote interrupt condition */ +#define FSI_SRSIM0 0x70 /* R/W: Remote interrupt mask */ +#define FSI_SRSIM4 0x74 /* R/W: Remote interrupt mask */ +#define FSI_SRSIS0 0x78 /* R : Remote interrupt status */ +#define FSI_SRSIS4 0x7c /* R : Remote interrupt status */ +#define FSI_LLMODE 0x100 /* R/W: Link layer mode register */ + +/* + * SMODE fields + */ +#define FSI_SMODE_WSC 0x80000000 /* Warm start done */ +#define FSI_SMODE_ECRC 0x20000000 /* Hw CRC check */ +#define FSI_SMODE_SID_SHIFT 24 /* ID shift */ +#define FSI_SMODE_SID_MASK 3 /* ID Mask */ +#define FSI_SMODE_ED_SHIFT 20 /* Echo delay shift */ +#define FSI_SMODE_ED_MASK 0xf /* Echo delay mask */ +#define FSI_SMODE_SD_SHIFT 16 /* Send delay shift */ +#define FSI_SMODE_SD_MASK 0xf /* Send delay mask */ +#define FSI_SMODE_LBCRR_SHIFT 8 /* Clk ratio shift */ +#define FSI_SMODE_LBCRR_MASK 0xf /* Clk ratio mask */ + +/* + * SISS fields + */ +#define FSI_SISS_CRC_ERROR BIT(31) +#define FSI_SISS_PROTO_ERROR BIT(30) +#define FSI_SISS_LBUS_PARITY_ERROR BIT(29) +#define FSI_SISS_LBUS_PROTO_ERROR BIT(28) +#define FSI_SISS_ACCESS_ERROR BIT(27) +#define FSI_SISS_LBUS_OWNERSHIP_ERROR BIT(26) +#define FSI_SISS_LBUS_OWNERSHIP_CHANGE BIT(25) +#define FSI_SISS_ASYNC_MODE_ERROR BIT(14) +#define FSI_SISS_OPB_ACCESS_ERROR BIT(13) +#define FSI_SISS_OPB_FENCED BIT(12) +#define FSI_SISS_OPB_PARITY_ERROR BIT(11) +#define FSI_SISS_OPB_PROTO_ERROR BIT(10) +#define FSI_SISS_OPB_TIMEOUT BIT(9) +#define FSI_SISS_OPB_ERROR_ACK BIT(8) +#define FSI_SISS_MFSI_MASTER_ERROR BIT(3) +#define FSI_SISS_MFSI_PORT_ERROR BIT(2) +#define FSI_SISS_MFSI_HP BIT(1) +#define FSI_SISS_MFSI_CR_PARITY_ERROR BIT(0) +#define FSI_SISS_ALL 0xfe007f00 + +/* + * SI1S fields + */ +#define FSI_SI1S_SLAVE_BIT 31 +#define FSI_SI1S_SHIFT_BIT 30 +#define FSI_SI1S_SCOM_BIT 29 +#define FSI_SI1S_SCRATCH_BIT 28 +#define FSI_SI1S_I2C_BIT 27 +#define FSI_SI1S_SPI_BIT 26 +#define FSI_SI1S_SBEFIFO_BIT 25 +#define FSI_SI1S_MBOX_BIT 24 + +/* + * SLBUS fields + */ +#define FSI_SLBUS_FORCE 0x80000000 /* Force LBUS ownership */ + +/* + * LLMODE fields + */ +#define FSI_LLMODE_ASYNC 0x1 + struct fsi_master; struct fsi_slave { From patchwork Thu Feb 15 22:07:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201778 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp151277dyb; Thu, 15 Feb 2024 14:10:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUo5bSZ53FGjdoBkjHCbi5X9Hy6VBmmipC3hh3VpyMqWHUVWOOLvozCQoh/HQ8tKfA6HpLPfz0B3bGbOifwI5rZ6KLkbA== X-Google-Smtp-Source: AGHT+IFhBaSj3niSLY1G0NVtRIYNClECUE2eT46N3j8CGp5Mw/enmtF+lwZYLlKTh6eOdam7lxv1 X-Received: by 2002:a05:6358:840a:b0:179:24b4:41ff with SMTP id b10-20020a056358840a00b0017924b441ffmr3387545rwk.1.1708035030219; Thu, 15 Feb 2024 14:10:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035030; cv=pass; d=google.com; s=arc-20160816; b=oYh6rh0G5ZyKHGrlMr6KkFP+STdt1iq0TQZAcE+41IJO0EcVzaV4oz0pCvDSQpOCjK mgiFy7zMV11cEHvShlhc/h4NpR+p3+IBX51jlPdWQZrAY2hxg7DvEbhrqGCKAd9MgeuK llgjhbUcU4HKkz9g8pxMgBpU6/o9xsrkdxqwQlmTpq7Al8kPtx7xp2wtngnHZUCsjSEI +vLO0pk/jRfu9YgU4u7m7epMY9M/nKXBXbvGnCrOAuCydJ0kYT5lPcoWbbSXryWXdIe1 gi93loT+L6xTboPNti4niLslAEm0e4DwdTdHFEfUp2iU/vMpMJATcL5DdxBuPb+pAmLz Yo8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=42KZToJ6L2oi/2I8rKEPazeyIcIc7KzaadnBTEbvxS8=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=mnsbdjaZDMElIZP3n5qjDra7VstfrGL6w8rchrm3am52s7vy6T+Dh1903yXa2qJb6f dz3rhyIlmJAs11TyWP8zd7l0/K10iZxG7Qa9CuUjSCnSwj1OTkFOR81sUfDxM4cAKtog PUsdZJMA7JUUwRfO4Itrkq1NU4+g0JDah620Oy0UThgO5KCe/4ZEY6PS0nPh4I5gy5mV 5GJvgHg1ghjRxONLNlfJ8FAkx5lq6TVa69uv05GswE9Ic+vUWhA/9tbCGNQX+S7hjWy3 RnZkU6ihDaJXdh5ltRWLo3EAYOHBgIKhqI2NXxAp1pyO8TMhIkGOAkWMtxsRUkb3L1JV ADFA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="oO/hgcS1"; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67734-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67734-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e9-20020a631e09000000b005cd6507bb84si1460338pge.183.2024.02.15.14.10.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:10:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67734-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="oO/hgcS1"; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67734-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67734-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6F7F428276D for ; Thu, 15 Feb 2024 22:09:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A3661468EB; Thu, 15 Feb 2024 22:08:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="oO/hgcS1" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE24D1419B5; Thu, 15 Feb 2024 22:08:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034903; cv=none; b=rmvO6xsO0SvAPWVS6sj9dUDacEioE9+VpSXnvc1mWTJpoLdlO4rLbsxx9UErHMFpq0Af3dBsvOdJE+2JEblHCYidNrech6mGnbhwAA1Eco541+NfPDRGq6m6HLlPWUIMb7ZOerKahRmr7doZevAu7zqfVR1f4cpPjWMjX0OrUQQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034903; c=relaxed/simple; bh=t+fL4dbYLUcdsIq4ZMykfifG2UxgfeRtAt3E1EOP/A8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QrSkSIfrduQLmKjiretHIOtL2P+UYcxkHCtLqGSp8dWvPPJDARelq7Xo3kJXYmUeBDeOj+GjFCzxE1Z5zLhfbNb5d2tF3InH+ehptj3B3JDQOFrtHAgylJ1d7In/ttUKyUA2yBfxSl4dLBj2VAv6hjYUeBCcxyu4ghibHiohfs4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=oO/hgcS1; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FM6OdU026556; Thu, 15 Feb 2024 22:08:07 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=42KZToJ6L2oi/2I8rKEPazeyIcIc7KzaadnBTEbvxS8=; b=oO/hgcS1eeYjUHFgTk9WVp2tStqGPRi4XIqneHPUwzqTvfxHHR2Zk4Th99GKmzJy9Wbm 6CVmfe7dATE65y3YFc/P+6szw2KFNnt5wcRicDj8OdGVQ0oXdL8yxG5YReImWNS1VurC DjmPggmChW6N2IPPMY96CKuoXKNN2B2suTTA9/VfC2cZj1FlOaXrlsCFjx3ehE4GtbAh tkg/fxnGn0c8SrkuxXU7eBi1bXO/wnx6+tzkfaHkfK45Neb+3kPZTUq/ssOsrBVF0U8u 1aV2hSZEhq05rlj75po+Fv2vpNrpoIo7RnoHqSp/Ceb+W6LKcPyzzW89L2zxI+UrVIgX dg== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9u46r133-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:06 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FJHAZ4024888; Thu, 15 Feb 2024 22:08:06 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6mfpqkfs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:06 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM83MJ27656862 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:05 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6833B58056; Thu, 15 Feb 2024 22:08:03 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1EC8558061; Thu, 15 Feb 2024 22:08:03 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:03 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 04/33] fsi: Improve master indexing Date: Thu, 15 Feb 2024 16:07:30 -0600 Message-Id: <20240215220759.976998-5-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: yacOQgyGxb1ACjOHEFL6Lk0Fd8klTmzp X-Proofpoint-GUID: yacOQgyGxb1ACjOHEFL6Lk0Fd8klTmzp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004539804324988 X-GMAIL-MSGID: 1791004539804324988 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 | 12 +++++------- drivers/fsi/fsi-master-hub.c | 2 ++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 7bf0c96fc017..1c687eb021a0 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -1271,7 +1271,6 @@ 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); @@ -1295,14 +1294,13 @@ int fsi_master_register(struct fsi_master *master) rc = device_register(&master->dev); if (rc) { ida_free(&master_ida, master->idx); - goto out; - } + } 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")) { - fsi_master_scan(master); + if (!of_property_read_bool(np, "no-scan-on-init")) + fsi_master_scan(master); } -out: + mutex_unlock(&master->scan_lock); return rc; } 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 Thu Feb 15 22:07:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201804 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp156230dyb; Thu, 15 Feb 2024 14:21:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCViNd0JRcF/81Q5arpZ7ZYxsI4wVBgqs5gyV/e/2EA/1uXRaml6bwS3ngBQILbv8F6en9vk2ZB2GSjbpvfKGHNiBjlmiQ== X-Google-Smtp-Source: AGHT+IHMXYNvQXeZquudu+Ray77eeIIQUEY8eQyepZclY9p4BHXiLOvNsxErSnGqHqCFNonj0TOt X-Received: by 2002:a17:906:3c18:b0:a3c:ea61:9359 with SMTP id h24-20020a1709063c1800b00a3cea619359mr1939008ejg.77.1708035690830; Thu, 15 Feb 2024 14:21:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035690; cv=pass; d=google.com; s=arc-20160816; b=qgE98VLzk978K6P6BfI/RhzVUOYyI5KxNpmSxM2kRrKW0ivg86SUavXq/RN0Aac1NW 6KDrat+zbB52oDRqOd2QNFDEaNfbld3bjzAMSJmb8m8IAxWWe9zOX/eB9pBDTRzM2Q5z BS8BtWwMFnwlLC4eVR6sCoUHTlUfzeY1WFIjCkhuOyJNYsH7yTssgxWlPwwKgF8G7lsS R675hhei2+GivQ1Kg2Ludi60Z5Obn09fmyLBP+4RldJKSkcu9IIYYw5sYCH05aiwxaeI /sSrA887HbA9ZiKMZlE6xGBGWdfGmE7D/N3pRdMst2S4UttTC7GZ4izAOXCcuqO/4hDV bfDg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=RLpioKRBvBvjG6X7CZTJJIG/dvzFzjHsdAqj+Tw9e24=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=lZVzTZLfNFnK41Do8Bf9MX9pyqxo7MWXEUZ0lc6LRDVcoGK8/bp00tXiQgdBSZb80X S/vun4MIn7pdKAXIV75Kq9Ne8NMyMAh5IWRbL2ppIQOKaOkYgOicHoyutqXIhsSdawFn 9U3CNzHEacUK5GsxeOompZ6iuQTF9IzS5Cg5ASBezt9tYSPFmP+9ZS3/hp/VVWzg6YgN wScRliiEtg0FoVzhAiGJbrl/E75xGZAHGX4HRAnCIbNfhpl+eCnsXiwgdrVCVBR1jK5T GdVyLZNC6XvLDGGuV7P7L6a4UbUGz30wcDgu96E9YX2gfKULvWX2vJh7N5dEe9I2I6P2 Vn0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=jXiMnlOB; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67746-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67746-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id n18-20020a170906119200b00a3d2dedf4c2si984237eja.1025.2024.02.15.14.21.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:21:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67746-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=jXiMnlOB; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67746-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67746-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DA91C1F2695D for ; Thu, 15 Feb 2024 22:13:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F01614D43B; Thu, 15 Feb 2024 22:08:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="jXiMnlOB" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45114145B3C; Thu, 15 Feb 2024 22:08:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034908; cv=none; b=FUgtO+IWHn0IInwvxMyCnGVLzryjAYS3ysWcQtYXnbgIs9+7NSIhSdXhhu24KVZ3cHbGOYe+Y0P5CjMIgK9Eljf7RpqhjPylSHrGQEigg+VrciLAgfX+6wja0m6aJKy8urHuWosptmi4UeDibjkLSiF0OKZy97+Y7d6QhVW1prM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034908; c=relaxed/simple; bh=gT16x+suHzi4RJDxnpVIxo63PiknxpyG8sAgpETh/No=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Q9+XmTydA0TVu/XtQxPZ19VA7Me+o2ObeA/jghKYULN2oQcUyNRPpaSM6o5yZITMRVOJfsuVeLy1v0G2UOnSszgZW1+UM3oWwtY5vFN38ZwG5CO6S4cA6oiUXQ9GiCWgx3ND/Yso1i0+oV4i1h3tTM7rK9KNT9/RHEAa/zKYAKc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=jXiMnlOB; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FJh3mm029685; Thu, 15 Feb 2024 22:08:09 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=RLpioKRBvBvjG6X7CZTJJIG/dvzFzjHsdAqj+Tw9e24=; b=jXiMnlOBP8y7xMfyHt6V1kMrCnT2m8JB1EqvSshyCojTBOvi1VlHPqmJPYKe4JkftPh+ 3CUCb5w+AUbolVIp6iJbGEUmnPw5L4LCZT2Mm2wuBLjZ26Euc1eEwdcu9orgNzMoimDR xbHgQORuqVMR1Og3tl1CrV+0GqRBg/mbcBszwuqqpauKIS3URHGrjOh+oBA951R13rD0 2fcy4lKSESVNsbbB8zAehV6aEk+Oe14S/VMtonvFHK0zp4LIYBuHQBrmMeK2giD0CAn+ GFMeSk7aQjHO5axlKTH6nE4KiT9RWvcg9vRDpVk4s366HYC37AMJqkttZdgnG3f8wdWs rQ== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9s0tjy3p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:09 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FM7dYg032572; Thu, 15 Feb 2024 22:08:08 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6kftyudn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:08 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM85YW22676140 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:07 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BB9F358063; Thu, 15 Feb 2024 22:08:03 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 705F358077; Thu, 15 Feb 2024 22:08:03 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:03 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 05/33] fsi: Use a defined value for default echo delay Date: Thu, 15 Feb 2024 16:07:31 -0600 Message-Id: <20240215220759.976998-6-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: DJBdCuUicqlEPNo5M5sYjpvGPU4Xxox9 X-Proofpoint-ORIG-GUID: DJBdCuUicqlEPNo5M5sYjpvGPU4Xxox9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 clxscore=1015 suspectscore=0 phishscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791005232512912745 X-GMAIL-MSGID: 1791005232512912745 Avoid hardcoding '16' several times. Signed-off-by: Eddie James --- drivers/fsi/fsi-core.c | 6 +++--- drivers/fsi/fsi-slave.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 1c687eb021a0..8823e8e56dab 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -1008,8 +1008,8 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) slave->link = link; slave->id = id; slave->size = FSI_SLAVE_SIZE_23b; - slave->t_send_delay = 16; - slave->t_echo_delay = 16; + slave->t_send_delay = FSI_SMODE_SD_DEFAULT; + slave->t_echo_delay = FSI_SMODE_ED_DEFAULT; /* Get chip ID if any */ slave->chip_id = -1; @@ -1160,7 +1160,7 @@ static int fsi_master_break(struct fsi_master *master, int link) if (master->send_break) rc = master->send_break(master, link); if (master->link_config) - master->link_config(master, link, 16, 16); + master->link_config(master, link, FSI_SMODE_SD_DEFAULT, FSI_SMODE_ED_DEFAULT); return rc; } diff --git a/drivers/fsi/fsi-slave.h b/drivers/fsi/fsi-slave.h index dba65bd4e083..dca9db0a42e5 100644 --- a/drivers/fsi/fsi-slave.h +++ b/drivers/fsi/fsi-slave.h @@ -41,8 +41,10 @@ #define FSI_SMODE_SID_MASK 3 /* ID Mask */ #define FSI_SMODE_ED_SHIFT 20 /* Echo delay shift */ #define FSI_SMODE_ED_MASK 0xf /* Echo delay mask */ +#define FSI_SMODE_ED_DEFAULT 16 /* Default echo delay */ #define FSI_SMODE_SD_SHIFT 16 /* Send delay shift */ #define FSI_SMODE_SD_MASK 0xf /* Send delay mask */ +#define FSI_SMODE_SD_DEFAULT 16 /* Default send delay */ #define FSI_SMODE_LBCRR_SHIFT 8 /* Clk ratio shift */ #define FSI_SMODE_LBCRR_MASK 0xf /* Clk ratio mask */ From patchwork Thu Feb 15 22:07:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201798 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp154365dyb; Thu, 15 Feb 2024 14:17:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVOfCNr7MitSITC1xV2q6aWgbGeTPYv1OA6I4ZGoia9hb3ZITlC/7aYLrz64qqMYXvfNkk4acvUI69xAuf9VWoXwMwvAA== X-Google-Smtp-Source: AGHT+IHh450hRjn2nsDzzKMb65uM9qAQ+TZUZXmEc57rFALgoClVR+mDZi5XxVdtEv5JNThbmgWH X-Received: by 2002:aa7:d047:0:b0:55f:ec52:73c4 with SMTP id n7-20020aa7d047000000b0055fec5273c4mr2402019edo.34.1708035438975; Thu, 15 Feb 2024 14:17:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035438; cv=pass; d=google.com; s=arc-20160816; b=rxDorsseN5O7g75NL/oB8zpaqhqG5px0pEau7rAJlHF/TXSKjtJlluvWmgU9xpyHK5 SwDWyEplxxMl4TAU8uc3D20YiIl9rxx90viwUAW4ZmP3X8Ch5PIy7AMCc8VL9BNBehOz T5487WT9ZkVQSEBURQ2+0ZOhrp/S0iJcT36wvaDPNYqtOqzO0eRBLvmhyneOP5YJomvq 2HcRg+NJg55RRCcyFZwRwaKT5+WWyZcnAERovZmV4XRv8f/vnlWpIBl0YtYPEMbQwQaj AsMCTxXkG8ZWVq5YQmE6w4hWY23bNcaXBlPEjgWmyuSczNBGpiZ6TDDY7Y78u1TMeHPz 8cXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=SZMmT6FmPBWoUrdH2eDLCNYypdqIO9JdHa/iodwva98=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=bzXy4Vxo7Gcru37uaTCBIABFkpyP/gK2touswcgWXPMoDICgo06SeDmXBxABmJTuN1 PZ6vlvLoK6yWNh4SFHXLu8KQQSGeG5dKCo8Pr1E988YBhJ1ikcKqI/13ft8QYkd0R3RQ yy4B0MPJpK8VFUnUgskO1yCFaIoW8Dupx9cmz6JAB4fq1pEl4atYELULTV6BlExTEDaW ce5oNd5fLMGIXpwGKK3iHdt9FJryrdKAAKPY7x1212153rJPrvYVCNfR03U3SRVxhkzr eybkqrgnj+W4lWN9L02E1OhMpveSM9y/e9YO+FXfWnc0ouFLP7WtxjSiv2d6CvYeSGjW KUHQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=fj8zNQvb; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67764-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67764-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id x3-20020aa7d383000000b00561fc141ba4si1052033edq.550.2024.02.15.14.17.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:17:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67764-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=fj8zNQvb; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67764-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67764-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 66AEB1F290E0 for ; Thu, 15 Feb 2024 22:17:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8407F15442B; Thu, 15 Feb 2024 22:08:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="fj8zNQvb" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED6E01509A0; Thu, 15 Feb 2024 22:08:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034919; cv=none; b=K62LukkKdtnVSeH0NSFr0ejNrzJ031t6RSFfRtXqi6Q2Xm0J/9DLfdGv5BSQwoIZIOHtoGjY+Qsze8LQhqbMp6bEdsEUapRPlA7bBy24qKEEsBYn5CjaGTuNlSDk1qgyFi/KNdDbTAi+Z5p5PnChs5bHexs9H/T7M8NoRYZY9/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034919; c=relaxed/simple; bh=bDDSQ59Hx/k13de0sfVOys3VHSzqY9HF+wtdkABTdf8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lWrOia8KfMeDj4OPjgT1yX0t22pVH57fFpDQDA7m0Vsyl90A6ujJPMq84hCLI8b743I7ajtwp/6lYmqnodJCDZ/ZQmoKJMNhiKXDxtZ0XaS6YfmI1c8wL9nsbyHSuS7an5ngku/UfRCYcAAxXq+dhDUx4PMFqd6PCcJxAGk/UaU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=fj8zNQvb; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLX2Vu019347; Thu, 15 Feb 2024 22:08:08 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=SZMmT6FmPBWoUrdH2eDLCNYypdqIO9JdHa/iodwva98=; b=fj8zNQvbBlLZIXMo7bRzv/YrgL/RhBRVGviVCft2IfWqRS7UGEg1ooqYM4Zf2R+DzEwH qrTv6GhM0pdUF7miBABbjw7v1ZhtrhnmWMWeP8jbIE/QGKnpdw4u39C01tqi55nhd/Ir lRlqw54jiTC8BbZJP2cdtL0hcEox3YMagqKhvdJg6SsxG/mWY5qFBbdR2tiYUdX690Kf O4A39ycQmnARIccKaOzAjNLvGiXPMhb1Bb8zFpqLzvEweN4bAwQB8uuFecV2yhHRIeMV xdhv8qmHEqUxs7TEWl0K4oZU7IjGuL5j2/AgXsmPqsXlox5EU4NkzFPpjks6bee4gXmT Yw== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9tmf8mwj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:07 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FJBGLo004329; Thu, 15 Feb 2024 22:08:06 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6kv0qtm6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:06 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM847M56361402 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:06 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1BE5D5807D; Thu, 15 Feb 2024 22:08:04 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C432E5807B; Thu, 15 Feb 2024 22:08:03 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:03 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 06/33] fsi: Expose master-specific local bus clock divider Date: Thu, 15 Feb 2024 16:07:32 -0600 Message-Id: <20240215220759.976998-7-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: zxHsSbRPAxHVdAHvp4zPvqaJAxwuxL6y X-Proofpoint-ORIG-GUID: zxHsSbRPAxHVdAHvp4zPvqaJAxwuxL6y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004968475111128 X-GMAIL-MSGID: 1791004968475111128 Instead of a hardcoded local bus clock divider, allow master drivers to select their local bus clock divider. Also expose master clock frequencies in the structure. This will allow FSI engine drivers to set and calculate their bus (I2C, SPI, etc) frequencies. Signed-off-by: Eddie James --- drivers/fsi/fsi-core.c | 27 ++++++++++++++++++++------- drivers/fsi/fsi-master-hub.c | 1 + drivers/fsi/fsi-master.h | 2 ++ drivers/fsi/fsi-slave.h | 1 + include/linux/fsi.h | 1 + 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 8823e8e56dab..9610b5948550 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -109,6 +109,12 @@ int fsi_device_peek(struct fsi_device *dev, void *val) return fsi_slave_read(dev->slave, addr, val, sizeof(uint32_t)); } +unsigned long fsi_device_local_bus_frequency(struct fsi_device *dev) +{ + return dev->slave->master->clock_frequency / dev->slave->master->lbus_divider; +} +EXPORT_SYMBOL_GPL(fsi_device_local_bus_frequency); + static void fsi_device_release(struct device *_device) { struct fsi_device *device = to_fsi_dev(_device); @@ -209,15 +215,15 @@ static inline uint32_t fsi_smode_sid(int x) return (x & FSI_SMODE_SID_MASK) << FSI_SMODE_SID_SHIFT; } -static uint32_t fsi_slave_smode(int id, u8 t_senddly, u8 t_echodly) +static uint32_t fsi_slave_smode(int id, int div, u8 t_senddly, u8 t_echodly) { return FSI_SMODE_WSC | FSI_SMODE_ECRC | fsi_smode_sid(id) | fsi_smode_echodly(t_echodly - 1) | fsi_smode_senddly(t_senddly - 1) - | fsi_smode_lbcrr(0x8); + | fsi_smode_lbcrr(div - 1); } -static int fsi_slave_set_smode(struct fsi_slave *slave) +static int fsi_slave_set_smode(struct fsi_slave *slave, int lbus_divider) { uint32_t smode; __be32 data; @@ -225,7 +231,8 @@ static int fsi_slave_set_smode(struct fsi_slave *slave) /* set our smode register with the slave ID field to 0; this enables * extended slave addressing */ - smode = fsi_slave_smode(slave->id, slave->t_send_delay, slave->t_echo_delay); + smode = fsi_slave_smode(slave->id, lbus_divider, slave->t_send_delay, + slave->t_echo_delay); data = cpu_to_be32(smode); return fsi_master_write(slave->master, slave->link, slave->id, @@ -281,7 +288,7 @@ static int fsi_slave_handle_error(struct fsi_slave *slave, bool write, slave->t_send_delay = send_delay; slave->t_echo_delay = echo_delay; - rc = fsi_slave_set_smode(slave); + rc = fsi_slave_set_smode(slave, master->lbus_divider); if (rc) return rc; @@ -773,7 +780,7 @@ static ssize_t slave_send_echo_store(struct device *dev, slave->t_send_delay = val; slave->t_echo_delay = val; - rc = fsi_slave_set_smode(slave); + rc = fsi_slave_set_smode(slave, master->lbus_divider); if (rc < 0) return rc; if (master->link_config) @@ -1028,7 +1035,7 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) "can't set slbus on slave:%02x:%02x %d\n", link, id, rc); - rc = fsi_slave_set_smode(slave); + rc = fsi_slave_set_smode(slave, master->lbus_divider); if (rc) { dev_warn(&master->dev, "can't set smode on slave:%02x:%02x %d\n", @@ -1288,6 +1295,12 @@ int fsi_master_register(struct fsi_master *master) if (!dev_name(&master->dev)) dev_set_name(&master->dev, "fsi%d", master->idx); + if (master->flags & FSI_MASTER_FLAG_SWCLOCK) + master->clock_frequency = 100000000; // POWER reference clock + + if (!master->lbus_divider) + master->lbus_divider = FSI_SMODE_LBCRR_DEFAULT; + master->dev.class = &fsi_master_class; mutex_lock(&master->scan_lock); diff --git a/drivers/fsi/fsi-master-hub.c b/drivers/fsi/fsi-master-hub.c index 36da643b3201..111bf7a11458 100644 --- a/drivers/fsi/fsi-master-hub.c +++ b/drivers/fsi/fsi-master-hub.c @@ -230,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.lbus_divider = 1; hub->master.idx = fsi_dev->slave->link + 1; hub->master.n_links = links; hub->master.read = hub_master_read; diff --git a/drivers/fsi/fsi-master.h b/drivers/fsi/fsi-master.h index 967622c1cabf..26e636ad9ef6 100644 --- a/drivers/fsi/fsi-master.h +++ b/drivers/fsi/fsi-master.h @@ -120,6 +120,8 @@ struct fsi_master { struct device dev; + unsigned long clock_frequency; + int lbus_divider; int idx; int n_links; int flags; diff --git a/drivers/fsi/fsi-slave.h b/drivers/fsi/fsi-slave.h index dca9db0a42e5..42af2fae0329 100644 --- a/drivers/fsi/fsi-slave.h +++ b/drivers/fsi/fsi-slave.h @@ -47,6 +47,7 @@ #define FSI_SMODE_SD_DEFAULT 16 /* Default send delay */ #define FSI_SMODE_LBCRR_SHIFT 8 /* Clk ratio shift */ #define FSI_SMODE_LBCRR_MASK 0xf /* Clk ratio mask */ +#define FSI_SMODE_LBCRR_DEFAULT 8 /* Default clk ratio */ /* * SISS fields diff --git a/include/linux/fsi.h b/include/linux/fsi.h index 3df8c54868df..e0309bf0ae07 100644 --- a/include/linux/fsi.h +++ b/include/linux/fsi.h @@ -24,6 +24,7 @@ extern int fsi_device_read(struct fsi_device *dev, uint32_t addr, extern int fsi_device_write(struct fsi_device *dev, uint32_t addr, const void *val, size_t size); extern int fsi_device_peek(struct fsi_device *dev, void *val); +extern unsigned long fsi_device_local_bus_frequency(struct fsi_device *dev); struct fsi_device_id { u8 engine_type; From patchwork Thu Feb 15 22:07:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201810 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp159926dyb; Thu, 15 Feb 2024 14:30:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWSZv5zO7j1fG+g95dATCuObapwmFGmXcxAJmVPFW8a+UwuFxuuZTKo5WWQ9gFnDfcwZIYdeWgXvGbjRt3c4SxPiM4ueQ== X-Google-Smtp-Source: AGHT+IF1kivut1bB/346rc6KGapX9Ox36rLj9BVH9nJYsGDTQc3MCUkimarTRhjNbQMXRe9odRuS X-Received: by 2002:a17:90b:f86:b0:297:114b:71b3 with SMTP id ft6-20020a17090b0f8600b00297114b71b3mr3275760pjb.26.1708036234256; Thu, 15 Feb 2024 14:30:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708036234; cv=pass; d=google.com; s=arc-20160816; b=Bb/KAlxFbYXGVi1pTA0jWgtM98iKPPqd8CD5iA5rALfKe79gxxgAphKEfMP4R76Wfv aOOv8FdZEQiYKOkDcxQeB5snzwUCiLFhek7TGzM9QfLk0o7s5H6LJs6BklfkFNGuOgfG 23zRhxorxT3/B3jQnQAC4wfI64beNhWzxJQLaxdcLuoRM7cWSug2k0JZouZVS2jnQwla 4wybCzV4wRRIA+rDV7jekz1cYO7q1WIDubGlwB7BqLMZcRm1SICV3q1kNB9ARnsNfZIx ucV4rdqGrofC8+iG1mK6ZPH9ACFrE5YAhoO738bErbsw5LEIvh4dQ59/ci92KBhl/ogF 0g8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ODxH4flBsSxTPu7P+G7uqK/TVCCy2iNAP3r6LUGYLcU=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=aCAOQpH1loUKTRxd6inZIAIO8pqQ1PzRmWQRXtrl7uJuovOyFfiRZRIKtFQri9/r0+ TF0fCaFWFnTSy+LZYpqJujp8NexsKvf2jLNwkmXSugQG2gEZDT6xRu/+GVcwXs3z4/Cz Vj/kK6A2DoeFYlBdcO/Pw8qq5nj83/HX/mHvydS051mWSULvtH3dFpdfekUQgSBSZngY PM69nePOJxJpkDtFapNb1wN4FMJsnzepkVETyZY4pj+/FRLisiyCYsMRDebr6tvU72Q0 BkkoaO4pHLRf+w74pRvQxv+uoXINIveRX3b5swkqYkA2oNZfiAkj9YdLsY0lzrNhotwU CDqQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=MYzKRCpb; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67767-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67767-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id l6-20020a17090a850600b0029922583a26si911795pjn.16.2024.02.15.14.30.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:30:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67767-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=MYzKRCpb; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67767-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67767-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 04702B26864 for ; Thu, 15 Feb 2024 22:17:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B45FB154456; Thu, 15 Feb 2024 22:08:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="MYzKRCpb" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D319153BEA; Thu, 15 Feb 2024 22:08:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034924; cv=none; b=TxZZUrJJVEKH5myKmW/Ryz4SI48SnbGlyFFAYVeaRtZK/vYH2j6JyYf8iZdRqyUIsbHw+QUxVaFov+ckttMXwuEpmyEOHAYLyMmVQ9uTffNpN+oeWi4ja5lm2O2GeoKQjOdZ1avcsi/axSAedD+TAXINlNSQqd8SKonIwJppvP4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034924; c=relaxed/simple; bh=dAwPkU5VJJMi4CHR0KERMlNXkq1qgmEceK78GEleApI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Y24w2J3wUVKfzisNJ8AAH3xHyCVPR915/sHaiTqr3ijRQXE3H3zuOaBrUNOliRyOn7uQIZgw2yn3Q8o0rXK7Dh3PXfm8aOIv8/Prq21bycbXq/yp7LLBMLFhNNzfuR8rsfJnWSLr5JbfS3D8K44Wzzac1N3VU2NrNnQWP6oAD10= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=MYzKRCpb; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FKOUKR002266; Thu, 15 Feb 2024 22:08:11 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=ODxH4flBsSxTPu7P+G7uqK/TVCCy2iNAP3r6LUGYLcU=; b=MYzKRCpbzj5vM0n9SuLEz6KxkpSWKxx4DHhsI27InPJzj9hjojjwCngGD5zMCR1cIXIi u/FMM1TrXM6QWv1qsDMOmwa+7/cNIpmhngTy2LO6V4GnAcrn6yFQ1f8g+vgVuyJwOrmE IxMeRsyKaab9yldzmw092Kmf+vXnP8BazcQ2axF+Vo8ot2C+3Z1G+w6AXnXrSSl/8Oq+ bGIQmcnLuVicYubAtFG+ir8lMwcQ5c7J4vMHZCn2rVxmsHgUE4bBoV32atWUQ7qH8ibo gk1xtEZwrcNsbvWFl4yUtGUBKHnmwMErbx08zXRP1X6b4dJai0gUg6maTkoYsofAuifG AQ== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9q8n597m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:10 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FJ6raS032589; Thu, 15 Feb 2024 22:08:09 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6kftyudr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:09 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM86Vs28246772 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:08 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6C4B658068; Thu, 15 Feb 2024 22:08:04 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 221995807C; Thu, 15 Feb 2024 22:08:04 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:04 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 07/33] ARM: dts: aspeed: p10 and tacoma: Set FSI clock frequency Date: Thu, 15 Feb 2024 16:07:33 -0600 Message-Id: <20240215220759.976998-8-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Ik0cGHrb8l2VvYEzn685OGUWkJ05c1C8 X-Proofpoint-ORIG-GUID: Ik0cGHrb8l2VvYEzn685OGUWkJ05c1C8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=783 impostorscore=0 adultscore=0 suspectscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791005802559620851 X-GMAIL-MSGID: 1791005802559620851 Now that the driver doesn't hardcode the clock divider, set it in the device tree. Signed-off-by: Eddie James --- arch/arm/boot/dts/aspeed/aspeed-bmc-opp-tacoma.dts | 1 + arch/arm/boot/dts/aspeed/ibm-power10-dual.dtsi | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/aspeed/aspeed-bmc-opp-tacoma.dts b/arch/arm/boot/dts/aspeed/aspeed-bmc-opp-tacoma.dts index 213023bc5aec..96a8f727bc38 100644 --- a/arch/arm/boot/dts/aspeed/aspeed-bmc-opp-tacoma.dts +++ b/arch/arm/boot/dts/aspeed/aspeed-bmc-opp-tacoma.dts @@ -193,6 +193,7 @@ &fsim0 { #address-cells = <2>; #size-cells = <0>; + clock-frequency = <100000000>; fsi-routing-gpios = <&gpio0 ASPEED_GPIO(Q, 7) GPIO_ACTIVE_HIGH>; fsi-mux-gpios = <&gpio0 ASPEED_GPIO(B, 0) GPIO_ACTIVE_HIGH>; diff --git a/arch/arm/boot/dts/aspeed/ibm-power10-dual.dtsi b/arch/arm/boot/dts/aspeed/ibm-power10-dual.dtsi index cc466910bb52..a93a241d005a 100644 --- a/arch/arm/boot/dts/aspeed/ibm-power10-dual.dtsi +++ b/arch/arm/boot/dts/aspeed/ibm-power10-dual.dtsi @@ -8,6 +8,7 @@ &fsim0 { #size-cells = <0>; cfam-reset-gpios = <&gpio0 ASPEED_GPIO(Q, 0) GPIO_ACTIVE_HIGH>; + clock-frequency = <100000000>; cfam@0,0 { reg = <0 0>; From patchwork Thu Feb 15 22:07:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201784 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp152580dyb; Thu, 15 Feb 2024 14:13:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUrhcHj7dWZflmGKH2OuWLyjXR0gPrZ0LDoob1/uQESW2SZ3NfVS6MtYmRz1d0oSiO78c7gsCE9t0+c5lbzrpbC3d9ntA== X-Google-Smtp-Source: AGHT+IEGmBOMnSN9lsU2Db9uA27rexEJArI5sCxrqE59aVc5zjtGuNc28D5Ft9AcoxsE3lHv3Crb X-Received: by 2002:a17:902:e88f:b0:1da:2272:f1ab with SMTP id w15-20020a170902e88f00b001da2272f1abmr4228368plg.0.1708035205646; Thu, 15 Feb 2024 14:13:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035205; cv=pass; d=google.com; s=arc-20160816; b=ElPQ41uyNjJW4O4bkBgQtkOYfTMdQsnrDQbBY/TSfbAEWq8PUGzivPKvv1kk/Cr7Ni IVlPPNNreko6lkFV2jyRkc/nY8NuLRBjFssI3mL3MMtt3lC5E39dcmow0KIIwdZ2+S3I +MIDLp9t/i/vapm5EMGRsacTcPUes2DE+KSRHvrAXwFCBbrEGnXftvitBViOxpfwK3CC hA+IAowFLvCOqS4SiSlrK+1ap2VCo26DN1vg0ZbRR5hWwnFtWhFTaIEM+4n9FUULYlc5 Pg0P0ki2RZtCcPWEsc9EhC7ssXsVittehJRcHuEE24DmGfm6yO36vbw+tcAW7I81sYfi uivA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=m8S+2xLwMphNFY1D6Sp8VRqoMTm6aplbC8DM8AmNxec=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=NwIEjwvpwU9HWcppKJS5cxebBz3iXdwNtcLCPpJ50uIJ8Jbqehg++bVGRQtw+n+nM4 aty2KGniLP1bo0xxIQ71Smrh6ZbVco6qLp1g9ZRM6WRiBtlWU57JXjucoNdG4VfY/omf wq4w9LCR9U7Ej4kE3gNDQnsyNB+W4OENUgzTpfWvvDnljyQVcL6RqqyilyWzUnPdOt4M +J8SArx336s4fhLlHpxHFkymgtKWULK9eBXVsKMFEgz2iGRzn7D7hxCuW0FRWrI7gKAg kb0VEiorbLRRG85HMdIdAtljGui3r0pArKLoaS1TorKmVCXZO33+ryXIIOa2y+X+Ts4h V+SA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=n0bDip3N; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67742-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67742-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bi11-20020a170902bf0b00b001d98fc60058si1775179plb.190.2024.02.15.14.13.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:13:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67742-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=n0bDip3N; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67742-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67742-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4EEDF281BEF for ; Thu, 15 Feb 2024 22:13:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0ABAE14D45F; Thu, 15 Feb 2024 22:08:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="n0bDip3N" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAD02145FF6; Thu, 15 Feb 2024 22:08:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034907; cv=none; b=jPGtvhX+fRxML1dXnmvailLL6hv6unqBd9GJ09QUlj3vf818Z8NabfWwUVa104PAxArZD+DsnwcMdfAEuz+I2onF8hpUVk3tA+yYtIs4sK/P7KDClCvJn3RWSxQXQ56HIqjPgUreXt3gxCmUCCzC9AtIc80LQOTrBh1CeE8FoIw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034907; c=relaxed/simple; bh=inaKuQeiyTMX0KtjdTI4EyJ9/PXUVO4eL0aHOzMV/Co=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sPWxZlYxfQL83KsGWXFzg3p00U1Oaavav+ZUI6zskhONOBchsYztVzRmzT4V7luoAeXjpEy+vhjcglArZhIiaB5L4sprv2lDxSqQMi4o/zFvonLXAFl0Veco/HoDhyW4Y+wRYH9ags9ix0diIOhRGNes6dSI/BvK3f19EEGV69I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=n0bDip3N; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLVKYN012233; Thu, 15 Feb 2024 22:08:11 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=m8S+2xLwMphNFY1D6Sp8VRqoMTm6aplbC8DM8AmNxec=; b=n0bDip3NfnAOmsWR/Igqd+nf23qcxNZIsuW4P+s1XrsGDCfZNscRVvMhgm7DAg5+OiUY YhW44Z0O0XxOKsZqlOGdVOLj/NLvAJ6TkdwxUV7xBHBOB0W70SXZD7pQAjhOwk0NYqgi x6313p0Nzq9uPjRy9gOnlNFTxeEpzIX3ylwSaq90wew2QwVX9hVqtjhYqh720AY1745S LWa8KAnAdNy270S5iu5CpCf3q4KP2fpO2T1xbGplVAiLAUOPSSqVGVUCz6p53p1znMkN GZuwPFDc8XV1qPCOS3LzCgPu9Dhf+nEtGablAhC1SF0Kt35VLpbwow4krxiKWAxZb+Nd JQ== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9q0v5ycj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:10 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FL5gej009694; Thu, 15 Feb 2024 22:08:09 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6npm781c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:09 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM86Pg13042330 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:08 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C969F5806E; Thu, 15 Feb 2024 22:08:04 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7E7CC5807B; Thu, 15 Feb 2024 22:08:04 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:04 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 08/33] fsi: core: Improve master read/write/error traces Date: Thu, 15 Feb 2024 16:07:34 -0600 Message-Id: <20240215220759.976998-9-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: PhYq85HPg32kvcIizXdSAvVUQFcu8DjN X-Proofpoint-GUID: PhYq85HPg32kvcIizXdSAvVUQFcu8DjN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 suspectscore=0 phishscore=0 mlxlogscore=916 clxscore=1015 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004724106995254 X-GMAIL-MSGID: 1791004724106995254 Consolidate the master read and write traces into one trace and change the result trace into an error trace for less spam. Signed-off-by: Eddie James --- drivers/fsi/fsi-core.c | 26 +++++---- include/trace/events/fsi.h | 112 ++++++++++++------------------------- 2 files changed, 51 insertions(+), 87 deletions(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 9610b5948550..a989a2007c0f 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -1110,14 +1110,15 @@ static int fsi_master_read(struct fsi_master *master, int link, { int rc; - trace_fsi_master_read(master, link, slave_id, addr, size); - rc = fsi_check_access(addr, size); - if (!rc) + if (!rc) { rc = master->read(master, link, slave_id, addr, val, size); - - trace_fsi_master_rw_result(master, link, slave_id, addr, size, - false, val, rc); + if (rc) + trace_fsi_master_error(master->idx, link, slave_id, addr, size, val, rc, + true); + else + trace_fsi_master_xfer(master->idx, link, slave_id, addr, size, val, true); + } return rc; } @@ -1127,14 +1128,15 @@ static int fsi_master_write(struct fsi_master *master, int link, { int rc; - trace_fsi_master_write(master, link, slave_id, addr, size, val); - rc = fsi_check_access(addr, size); - if (!rc) + if (!rc) { rc = master->write(master, link, slave_id, addr, val, size); - - trace_fsi_master_rw_result(master, link, slave_id, addr, size, - true, val, rc); + if (rc) + trace_fsi_master_error(master->idx, link, slave_id, addr, size, val, rc, + false); + else + trace_fsi_master_xfer(master->idx, link, slave_id, addr, size, val, false); + } return rc; } diff --git a/include/trace/events/fsi.h b/include/trace/events/fsi.h index 5ff15126ad9d..fed8835f438e 100644 --- a/include/trace/events/fsi.h +++ b/include/trace/events/fsi.h @@ -8,101 +8,63 @@ #include -TRACE_EVENT(fsi_master_read, - TP_PROTO(const struct fsi_master *master, int link, int id, - uint32_t addr, size_t size), - TP_ARGS(master, link, id, addr, size), +TRACE_EVENT(fsi_master_xfer, + TP_PROTO(int master_idx, int link, int id, uint32_t addr, size_t size, const void *data, + bool read), + TP_ARGS(master_idx, link, id, addr, size, data, read), TP_STRUCT__entry( - __field(int, master_idx) - __field(int, link) - __field(int, id) - __field(__u32, addr) - __field(size_t, size) + __field(int, master_idx) + __field(int, link) + __field(int, id) + __field(uint32_t, addr) + __field(int, size) + __field(uint32_t, data) + __field(bool, read) ), TP_fast_assign( - __entry->master_idx = master->idx; + __entry->master_idx = master_idx; __entry->link = link; __entry->id = id; __entry->addr = addr; - __entry->size = size; - ), - TP_printk("fsi%d:%02d:%02d %08x[%zu]", - __entry->master_idx, - __entry->link, - __entry->id, - __entry->addr, - __entry->size - ) -); - -TRACE_EVENT(fsi_master_write, - TP_PROTO(const struct fsi_master *master, int link, int id, - uint32_t addr, size_t size, const void *data), - TP_ARGS(master, link, id, addr, size, data), - TP_STRUCT__entry( - __field(int, master_idx) - __field(int, link) - __field(int, id) - __field(__u32, addr) - __field(size_t, size) - __field(__u32, data) - ), - TP_fast_assign( - __entry->master_idx = master->idx; - __entry->link = link; - __entry->id = id; - __entry->addr = addr; - __entry->size = size; + __entry->size = (int)size; __entry->data = 0; memcpy(&__entry->data, data, size); + __entry->read = read; ), - TP_printk("fsi%d:%02d:%02d %08x[%zu] <= {%*ph}", - __entry->master_idx, - __entry->link, - __entry->id, - __entry->addr, - __entry->size, - (int)__entry->size, &__entry->data - ) + TP_printk("fsi%d:%02d:%02d %s %08x {%*ph}", __entry->master_idx, __entry->link, + __entry->id, __entry->read ? "read" : "write", __entry->addr, __entry->size, + &__entry->data) ); -TRACE_EVENT(fsi_master_rw_result, - TP_PROTO(const struct fsi_master *master, int link, int id, - uint32_t addr, size_t size, - bool write, const void *data, int ret), - TP_ARGS(master, link, id, addr, size, write, data, ret), +TRACE_EVENT(fsi_master_error, + TP_PROTO(int master_idx, int link, int id, uint32_t addr, size_t size, const void *data, + int ret, bool read), + TP_ARGS(master_idx, link, id, addr, size, data, ret, read), TP_STRUCT__entry( - __field(int, master_idx) - __field(int, link) - __field(int, id) - __field(__u32, addr) - __field(size_t, size) - __field(bool, write) - __field(__u32, data) - __field(int, ret) + __field(int, master_idx) + __field(int, link) + __field(int, id) + __field(uint32_t, addr) + __field(int, size) + __field(uint32_t, data) + __field(int, ret) + __field(bool, read) ), TP_fast_assign( - __entry->master_idx = master->idx; + __entry->master_idx = master_idx; __entry->link = link; __entry->id = id; __entry->addr = addr; - __entry->size = size; - __entry->write = write; + __entry->size = (int)size; __entry->data = 0; - __entry->ret = ret; - if (__entry->write || !__entry->ret) + if (!read) memcpy(&__entry->data, data, size); + __entry->ret = ret; + __entry->read = read; ), - TP_printk("fsi%d:%02d:%02d %08x[%zu] %s {%*ph} ret %d", - __entry->master_idx, - __entry->link, - __entry->id, - __entry->addr, - __entry->size, - __entry->write ? "<=" : "=>", - (int)__entry->size, &__entry->data, - __entry->ret - ) + TP_printk("fsi%d:%02d:%02d %s %08x {%*ph} %d", __entry->master_idx, __entry->link, + __entry->id, __entry->read ? "read" : "write", __entry->addr, __entry->size, + &__entry->data, __entry->ret) ); TRACE_EVENT(fsi_master_break, From patchwork Thu Feb 15 22:07:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201782 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp152237dyb; Thu, 15 Feb 2024 14:12:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWarXrY9ha2wKd8ZrfwYlGRfTFccHbERH3Ac0wYiWrgjoz70rrM07SdYbrequ/l1Q97031935R5BTXkQ8Nvhp4HevqvKA== X-Google-Smtp-Source: AGHT+IHlEZpSg4dtBLwigzIcvwq70BnmwiL3q4vB8iPyx2oJ28XGk+eCS85jqUyCgtZo4oRA+O9d X-Received: by 2002:a05:6a20:43a2:b0:19e:ba42:4edf with SMTP id i34-20020a056a2043a200b0019eba424edfmr4247576pzl.7.1708035159938; Thu, 15 Feb 2024 14:12:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035159; cv=pass; d=google.com; s=arc-20160816; b=wcf2yAdy8Xqkj4T3/R+L3Luqzsn5v8Tkx57iHOg/jHyMzogUjo8dISvjLs1WyLCTfy CGwGjMk+q9u4y3tYOiGkZk09dovr0NpXHcDdVx1HBC1Ffn2j2KhOn/ED9QLrDmdBhN4W NuNYfzjVCGucCGzczqi0QmVgrikrdISJc/EsFqp/PwXVfjB9r1z7bhjmq05jH8uxo0Bo f2Elp79dd4lIwgurcP6CYwOZ9bXTR8Gapp+g5NJT+088B4288MiDyQJOHI9pnpjKlXp5 ++8FClpg6GmzNg1t2+Rm0L8xNkcHi7AqNFW+SVzywXVUzr5cGHAWgPxQxfsyKFqrNCKL cn0w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=CbVBtI9wWX/Vle86BDnixujDHBg2fVH5tOyNC480SYk=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=RaKI1/Ns0zOnW4vwvrdab+JHXWzB3CTE+BQ5UnoJVXy1E2X2ytuA9XMR2ywvUAVxKP w9iHEz6DMf/BAis0YkuIc3MJ/7wzHO4kDgyK+c9cCHliCAM6IzJ+2YDbsaSo4FWYxuOM JM7ff8qVFelr7zhNkpHDZwOGdCtehtWysiOrRTdmrpi6vUsh9ubwOKhMt7HQb9TV84jl 7Gjyrttk4Cxgsb7Bk+o9uiu5KBJYd/jJUgVm3eYX4ekRLfDJuJhUC4kkjHYfBBvN+4vc uFDCl1Nm0L5sXJH+pPTWEk7NpWmXdcOkReZYUYQzhCj6XYElkQtk/zHRAPB8UvDpOuRv kwNQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=MiCYFWaE; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67740-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67740-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e16-20020aa78250000000b006dda0a1b3c2si1760785pfn.156.2024.02.15.14.12.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:12:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67740-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=MiCYFWaE; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67740-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67740-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BA2F52817A4 for ; Thu, 15 Feb 2024 22:12:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9724614C590; Thu, 15 Feb 2024 22:08:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="MiCYFWaE" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27B72145B31; Thu, 15 Feb 2024 22:08:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034906; cv=none; b=Y2D7jY9CJaCSTK5kTQvMLRubRdNbxVfpPlIOy8xE6NRNl1il8/VDPvlZnCAPvDcIaMZe5poxK7bbs7Apy0W8rpfdjReQjbjCZ6ZG4+40FKrr14IasgP/zhngadxGZOOydfVx/ozhtx7zJ3HxFf21Za/WLrAcxXV9l2i9dVXGqro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034906; c=relaxed/simple; bh=F2EI8CjKMR5+W0auTiL1ZfI3q7DIl9lL0XVfiof8NJw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MNuweObTpd75vHV7hdUcd8j9RWUOhCSDk+LXZaL4MU7KVSG26lu6zxn7IrO0FmP12pGJBT6HCl+p+GjvzrdYnqbo0KmOtaCeGYDPf5/3KVhY+qdDSzsLPf3WELkGTr7V4TfMr2gcrw2Ibbtf7zZmCwC96lFYak1LvSS73wUohro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=MiCYFWaE; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLX1T3019287; Thu, 15 Feb 2024 22:08:08 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=CbVBtI9wWX/Vle86BDnixujDHBg2fVH5tOyNC480SYk=; b=MiCYFWaEMiJz9u050bK9Ky+XFQ9cps906GqUsuxLU0lc1W+nJ2+OTK8J1AvQ0zIcNuot QILQVEmTVxIXkV9H7PXx/frVP/G3GSggo9/XcByI7btD8rPt1XWiK1jW7W6jVPyPDufy 2KcjTx38E2mI8aR8L0GGa3fRPeQ2L0rtz50Q4CoZZ5v1rgnsaNZmaIhlq34SBbcfZtQH bdWYvE3FhtJV1fkNsyWnwRLmAEV8VW20hW66t1LH5mbeLS0NX7kf32CDFyNK/nu9MX5G 1IXydwpYToZToM8B/PrCCerevvJjedcHL5Oc3Pk8H1NfEhho0ZLYywZKygiIGl5JdTOd Eg== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9tmf8mx1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:08 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLB5ue010083; Thu, 15 Feb 2024 22:08:07 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6npm7812-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:07 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM854o46596566 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:07 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 27C0E58075; Thu, 15 Feb 2024 22:08:05 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D1A3358081; Thu, 15 Feb 2024 22:08:04 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:04 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 09/33] fsi: core: Add slave error trace Date: Thu, 15 Feb 2024 16:07:35 -0600 Message-Id: <20240215220759.976998-10-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: wWQh76vqmlatYEeFJLW8EAXOCTTuDROz X-Proofpoint-ORIG-GUID: wWQh76vqmlatYEeFJLW8EAXOCTTuDROz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 mlxlogscore=983 adultscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004675731671838 X-GMAIL-MSGID: 1791004675731671838 Trace out the FSI slave status and interrupt status. Signed-off-by: Eddie James --- drivers/fsi/fsi-core.c | 1 + include/trace/events/fsi.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index a989a2007c0f..e6ed2d0773b6 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -185,6 +185,7 @@ static int fsi_slave_report_and_clear_errors(struct fsi_slave *slave) dev_dbg(&slave->dev, "status: 0x%08x, sisc: 0x%08x\n", be32_to_cpu(stat), be32_to_cpu(irq)); + trace_fsi_slave_error(slave, be32_to_cpu(irq), be32_to_cpu(stat)); /* clear interrupts */ return fsi_master_write(master, link, id, FSI_SLAVE_BASE + FSI_SISC, diff --git a/include/trace/events/fsi.h b/include/trace/events/fsi.h index fed8835f438e..5509afc98ee8 100644 --- a/include/trace/events/fsi.h +++ b/include/trace/events/fsi.h @@ -115,6 +115,25 @@ TRACE_EVENT(fsi_master_unregister, TP_printk("fsi%d (%d links)", __entry->master_idx, __entry->n_links) ); +TRACE_EVENT(fsi_slave_error, + TP_PROTO(const struct fsi_slave *slave, uint32_t sisc, uint32_t sstat), + TP_ARGS(slave, sisc, sstat), + TP_STRUCT__entry( + __field(int, master_idx) + __field(int, link) + __field(uint32_t, sisc) + __field(uint32_t, sstat) + ), + TP_fast_assign( + __entry->master_idx = slave->master->idx; + __entry->link = slave->link; + __entry->sisc = sisc; + __entry->sstat = sstat; + ), + TP_printk("fsi%d:%02d sisc:%08x sstat:%08x", __entry->master_idx, __entry->link, + __entry->sisc, __entry->sstat) +); + TRACE_EVENT(fsi_slave_init, TP_PROTO(const struct fsi_slave *slave), TP_ARGS(slave), From patchwork Thu Feb 15 22:07:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201779 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp151575dyb; Thu, 15 Feb 2024 14:11:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXQ9IoeLyfewvfpE9hKCD8sEhG3ykzn88HRSljBgXVyMLFulv41ot2v5QATTUGHK3c3v9Ts0wjk6GqaQ8qwcxtG9R7X5Q== X-Google-Smtp-Source: AGHT+IEICS4QGIA9eXilaGwP1p77B4KUZVRA7dZ2qDunjBGnyKNhslG1eLbeKhpbveu6OCqMYwUR X-Received: by 2002:a05:6870:6125:b0:21e:6080:d541 with SMTP id s37-20020a056870612500b0021e6080d541mr310682oae.48.1708035067244; Thu, 15 Feb 2024 14:11:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035067; cv=pass; d=google.com; s=arc-20160816; b=kWpFlMC08U+zbm3gbJbIM4LujuffV6y16ImF8C9smclILRcvsALwCndfW56+lsDSl2 QHzJOnPLb6hebEw3S1dY6NIy7MvJqNmtRlCQHEd5h4y5wqLNAMEPCZEoxNpu9tkpRqwj e5JBPKifmF56Ey7MHZ2Puakx5C3DhZHxMFRu63ZsuBCdyjVrp+FB8GZ+WZC2/MJBnRdB Us9J4gmuPNo/rpo9JjO9QAN/LDvvo1qkC+HkhdoJVA5ySdve4ke131aS9ybJlmZ0Ewsr N1U48gj4Fe5KUHtftJRX66PYHQ0SpklMtWQWtsS6OKMwShhid9S7dYH+594Yzd+2AD4y jmPA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=gaRn11yQSzCtGgfOHG0WfDL4IGGOB1/y2J4JPHKXeY0=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=NO/3P2UoHRTJmBDsEznsOom2c5baDXxr++BmiPuujfbBG8L+ZK8Pgh/Se8Siaxs2/r oMGZuIXtg9sNEwQP454Dq4zqT1SDgIfsUx1IEE4/dV0lEUO90kQ3anq591mlWXgGZsnk l+vItsnaTi7xowwMQN7sJD46z0mHYUgvMnMLBtxnGDuYY8qtmm7X/hwOpQxWUuAPqDT8 ARtI+Oe50HBjTHA/ZLZIQZtQz7Y2fZn+YPXEak0SaNYCcMh19Vl4LYGqi9kmc6EYDirK 1ONh7u7DiTOGHMH6owhuWy1ctfiFcgvELHGkz5Z/PSkPJUTAHBJrPBihbRCgRHkeLQPw yo9g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=bYjpVES5; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67739-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67739-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d15-20020ac8534f000000b0042c7c50dbefsi2219034qto.84.2024.02.15.14.11.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:11:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67739-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=bYjpVES5; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67739-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67739-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BD9D11C218FB for ; Thu, 15 Feb 2024 22:11:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0732D148FEA; Thu, 15 Feb 2024 22:08:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="bYjpVES5" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB167145342; Thu, 15 Feb 2024 22:08:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034905; cv=none; b=XVJXZch0K1SZKU0pmMk3EUiBnjfiwZukVwjj0rkjL7CjOzV7dzlM9CP4YQXqyecwsJrFqEZjmO1+OkSd2e/7h5HCxonMzdReIWJQPXV6QAGfqeqo38r2Gu/EO6kmv3l7MAVu0BlNhkEYsD1VMGy+Akj7jX0uUClgPWhHcioFzkg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034905; c=relaxed/simple; bh=NGXJUu33Lr1l9NXaZa1510h0VGdsd6eNUEVT355jTIo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=o76b/ELuviBHUcVxO0V9jPWCdzCSVBIxms2pFuVjqwaYTHcm0OuCd2u9Y+7Kn2Q3brififT0tFuRy5kIDVANuPiiElpyDkOaNOB36QxX70E3xoi6xboZmBcEDrqUymmp9Ti4PrdQIyjAfBjiZ3HlC86Wr70ArRPhsTqIpGEczYE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=bYjpVES5; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41FKV1KB020929; Thu, 15 Feb 2024 22:08:10 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=gaRn11yQSzCtGgfOHG0WfDL4IGGOB1/y2J4JPHKXeY0=; b=bYjpVES54VvNdAivXZqMmH46h/Rkn4j8PMJ8vJa0DthRR2UfYUq6PBOgYzQUtMrsYf0G Ovq52PoYU/ADRBHt8S9AnpOfQdZ3K4jFhgWBN6g7ETzj02Ax0S9X97PolKmGdkqt+XeP El96X0bCLWFZomDCmaK0QoinHQd7FCNKR/ETMih7/9xPpM3F3Fy2LcAnY9r5SW5I8oYv YfXCLGEIEonCigaHla05nuGN9LZx0cZ40erCQlgGyy3vbl2dZjOOLiJmtfNVa4mV2ENl pNr5Xse7TS4klDKgV83bSPkOgoN/TpCVkCarovF0fjz5ezEF8ZRfyQgTufTFaum57bNC nQ== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9q0v5yck-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:10 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLbR6U032605; Thu, 15 Feb 2024 22:08:09 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6kftyudu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:09 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM87F349414650 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:09 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7D31F58080; Thu, 15 Feb 2024 22:08:05 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 315E758082; Thu, 15 Feb 2024 22:08:05 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:05 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 10/33] fsi: aspeed: Add AST2700 support Date: Thu, 15 Feb 2024 16:07:36 -0600 Message-Id: <20240215220759.976998-11-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: lUQIpHZRxAjufZhvUTa8aRO5RhMkXiqI X-Proofpoint-GUID: lUQIpHZRxAjufZhvUTa8aRO5RhMkXiqI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 clxscore=1015 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004578290346876 X-GMAIL-MSGID: 1791004578290346876 AST2700 requires a few bits set differently in the OPB retry counter register, so add some match data and set the register accordingly. Signed-off-by: Eddie James --- drivers/fsi/fsi-master-aspeed.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index f0a19cd451a0..d6e923b8f501 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -18,6 +18,10 @@ #include "fsi-master.h" +struct fsi_master_aspeed_data { + u32 opb_retry_counter; +}; + struct fsi_master_aspeed { struct fsi_master master; struct mutex lock; /* protect HW access */ @@ -60,6 +64,8 @@ static const u32 fsi_base = 0xa0000000; #define OPB1_READ_ORDER2 0x60 #define OPB_RETRY_COUNTER 0x64 +#define OPB_RETRY_COUNTER_AST2600 0x00000010 +#define OPB_RETRY_COUNTER_AST2700 0x000c0010 /* OPBn_STATUS */ #define STATUS_HALFWORD_ACK BIT(0) @@ -536,6 +542,8 @@ static int tacoma_cabled_fsi_fixup(struct device *dev) static int fsi_master_aspeed_probe(struct platform_device *pdev) { + const struct fsi_master_aspeed_data *md = of_device_get_match_data(&pdev->dev); + u32 opb_retry_counter = md ? md->opb_retry_counter : OPB_RETRY_COUNTER_AST2600; struct fsi_master_aspeed *aspeed; int rc, links, reg; __be32 raw; @@ -579,8 +587,7 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) writel(OPB1_XFER_ACK_EN | OPB0_XFER_ACK_EN, aspeed->base + OPB_IRQ_MASK); - /* TODO: determine an appropriate value */ - writel(0x10, aspeed->base + OPB_RETRY_COUNTER); + writel(opb_retry_counter, aspeed->base + OPB_RETRY_COUNTER); writel(ctrl_base, aspeed->base + OPB_CTRL_BASE); writel(fsi_base, aspeed->base + OPB_FSI_BASE); @@ -656,8 +663,23 @@ static int fsi_master_aspeed_remove(struct platform_device *pdev) return 0; } +static const struct fsi_master_aspeed_data fsi_master_ast2600_data = { + .opb_retry_counter = OPB_RETRY_COUNTER_AST2600, +}; + +static const struct fsi_master_aspeed_data fsi_master_ast2700_data = { + .opb_retry_counter = OPB_RETRY_COUNTER_AST2700, +}; + static const struct of_device_id fsi_master_aspeed_match[] = { - { .compatible = "aspeed,ast2600-fsi-master" }, + { + .compatible = "aspeed,ast2600-fsi-master", + .data = &fsi_master_ast2600_data, + }, + { + .compatible = "aspeed,ast2700-fsi-master", + .data = &fsi_master_ast2700_data, + }, { }, }; MODULE_DEVICE_TABLE(of, fsi_master_aspeed_match); From patchwork Thu Feb 15 22:07:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201814 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp167948dyb; Thu, 15 Feb 2024 14:51:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUHNl/2bIcn6dqkfTjFfcF23PfmYydhzYwsaGHvFf+/5DvBp3ay3UFySxox41ZJ8iMW77+wRhkqeDQ/97Omv82CE4DgfA== X-Google-Smtp-Source: AGHT+IGIFLOg2DZKh6bzDZaZJG0gWT9tOqRdQFt+9Y+gAWDyY48u8NVoIhXwRtolftbl6cacLQOw X-Received: by 2002:a05:6402:12c9:b0:55e:f37f:7fc5 with SMTP id k9-20020a05640212c900b0055ef37f7fc5mr2205359edx.14.1708037516712; Thu, 15 Feb 2024 14:51:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708037516; cv=pass; d=google.com; s=arc-20160816; b=aKBJYMG90S4hHKcRHXK0izZwjTSKmzIHAtrKo9ntPcbKgWjyLZUCw8fE4dHqIztGh/ Nje3Vq6KSbaHAEnctBzFww88dkT6B5fWekMSLSn4Qbal1HG966BnwlDyUO3kJR9/PuS3 QSanyyicN/tzs6i7ShQPlO+SC0A2FNr/5oV3X1fJU5EpJoNSKBzj0HQAtYV3FwH84XGf BgPb5LGeUUSSLIrRUXp8yQOjfxk0oc/nWWiagE7gT8CmYjw81ta4LH6WbpGsDG/VOAbF wYUk5MdaXRKTz1KvM8GZ2qAKLG9JNqNhgnicT+l3dQ6dfPxwcoJ6PnPCzgqS4D/yr+Pv c5Ag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bcqBdP1smZ142CVdipR5CsJhhC56BJDRe32BgoHDJb0=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=s4+f4rkChNVdBsj6mNedrd+gCWpZpCeNoAGQhIaXI6MFtf7dEQ1dhqhT2SSx9VL+er Bm81saCteRFl9zbqtRUVjXuSx2MavlFCqlYqL28b6R2qtVc75WZ92cX3nJ/G/a5vLuMr e5Gkp1hX1dDFUVD7jpYbcMF0PiFMONh/lmbw5dNfj8lMjjAaaAyDtP9fY4yIBeBcSZ2L 7W0Oycp5RVpuh8kAQnVqb0Uuj0lkDQ7Otl8sp0nhPw3vlsIYIisnfbQ8tAI5qzLzuXHP WeI1F7WiN/d+qGAVUSqtRLDNUTHm4MXjcQUU5phFS0xi+nNFZPqbtbDt6SWp2hqmSQ7G VkXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=h2dHszgp; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67743-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67743-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id u23-20020a056402065700b00563930a15a6si1022061edx.461.2024.02.15.14.51.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:51:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67743-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=h2dHszgp; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67743-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67743-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 118531F26D1A for ; Thu, 15 Feb 2024 22:13:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C54E814D447; Thu, 15 Feb 2024 22:08:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="h2dHszgp" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29257146010; Thu, 15 Feb 2024 22:08:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034908; cv=none; b=VnSRIQkzVI2b9tKJRkJOHZzypqfQKrzh5CuqTTgbSXgoQS/zprOgLlJisPV05InLFxiL25kkZc6AfPSzYfBBUtJiN2o8EGgXa8nJo8ooNVyTllKPgG9O9/8JqxjnL1D4akyLnF4nwOA5SFJhOcuukjo/UUTOdFeVUNsuYFj+afY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034908; c=relaxed/simple; bh=rnrW55EMd5WY1H/Lf4PHZ/r+oG7ZBsAslE1xLX4eUiA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=j6Uxk/grEN9hMPkOAW26HIuOtE19olK3O+FAPpWPUiNDaUt2voCkbrX4xnhXkbR9wLFSalWnPIuVCIRXmZ8vpxKTqdZ9y8Rbr8GG5WsWT8oleTsPqBWDDuMAIiQDsKb0bOj8ymY1PDyl0C6jw9n6TZCBh/cJjX69kXMav3uFECI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=h2dHszgp; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FM0XBk017924; Thu, 15 Feb 2024 22:08:11 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=bcqBdP1smZ142CVdipR5CsJhhC56BJDRe32BgoHDJb0=; b=h2dHszgpB5H1g7lkUbxqPswzrsfW/vrwIFlDBpbZOdP1e5+wEmpb0kLkSkznvQg4lcDo bARFQ/4+kBrvJurOt6kKivwXjk3z24HANZcau7gRQlB0QdSb4QWQFMB77+VG5cwEuHEg Iqc0HdLlT87yMJU7maCiSr7GfnLf+sH/rOxZ05mqNT7XnNza5w7Zsho/6PK1Qe8OXQ/G uv5gJYLreAS5A6+RwBuWHTg2pGsXOHvLcnp3UJs6/oCSl/Q2toITOPwGji+VJIEr4B9r qPcYpuzcsGV5Ier0CVL5htWPaRESfQ6WhXgViiY8YsNudrH39tX4j3UY9Y/1KJlu8VZS nA== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9u1bg69b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:10 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FJANdP004251; Thu, 15 Feb 2024 22:08:10 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6kv0qtmh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:10 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM87kN9306826 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:09 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D031958072; Thu, 15 Feb 2024 22:08:05 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8570558086; Thu, 15 Feb 2024 22:08:05 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:05 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 11/33] fsi: core: Add slave spinlock Date: Thu, 15 Feb 2024 16:07:37 -0600 Message-Id: <20240215220759.976998-12-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 1NXmfBBLW8NuuHvZgD0892lFSsN0VJSh X-Proofpoint-ORIG-GUID: 1NXmfBBLW8NuuHvZgD0892lFSsN0VJSh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 adultscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791007147152844322 X-GMAIL-MSGID: 1791007147152844322 FSI slave operations were not locked, meaning that during slave error recovery operations, other slave accesses may take place, resulting in incorrect recovery and additional errors. Make the slave access and error recovery atomic with a spinlock. Don't use a mutex for future interrupt handling support. Signed-off-by: Eddie James --- drivers/fsi/fsi-core.c | 7 +++++++ drivers/fsi/fsi-slave.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index e6ed2d0773b6..eb15e5f5a2ee 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -304,6 +304,7 @@ static int fsi_slave_handle_error(struct fsi_slave *slave, bool write, int fsi_slave_read(struct fsi_slave *slave, uint32_t addr, void *val, size_t size) { + unsigned long flags; uint8_t id = slave->id; int rc, err_rc, i; @@ -311,6 +312,7 @@ int fsi_slave_read(struct fsi_slave *slave, uint32_t addr, if (rc) return rc; + spin_lock_irqsave(&slave->lock, flags); for (i = 0; i < slave_retries; i++) { rc = fsi_master_read(slave->master, slave->link, id, addr, val, size); @@ -321,6 +323,7 @@ int fsi_slave_read(struct fsi_slave *slave, uint32_t addr, if (err_rc) break; } + spin_unlock_irqrestore(&slave->lock, flags); return rc; } @@ -329,6 +332,7 @@ EXPORT_SYMBOL_GPL(fsi_slave_read); int fsi_slave_write(struct fsi_slave *slave, uint32_t addr, const void *val, size_t size) { + unsigned long flags; uint8_t id = slave->id; int rc, err_rc, i; @@ -336,6 +340,7 @@ int fsi_slave_write(struct fsi_slave *slave, uint32_t addr, if (rc) return rc; + spin_lock_irqsave(&slave->lock, flags); for (i = 0; i < slave_retries; i++) { rc = fsi_master_write(slave->master, slave->link, id, addr, val, size); @@ -346,6 +351,7 @@ int fsi_slave_write(struct fsi_slave *slave, uint32_t addr, if (err_rc) break; } + spin_unlock_irqrestore(&slave->lock, flags); return rc; } @@ -1005,6 +1011,7 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) if (!slave) return -ENOMEM; + spin_lock_init(&slave->lock); dev_set_name(&slave->dev, "slave@%02x:%02x", link, id); slave->dev.type = &cfam_type; slave->dev.parent = &master->dev; diff --git a/drivers/fsi/fsi-slave.h b/drivers/fsi/fsi-slave.h index 42af2fae0329..6f8fb97023fb 100644 --- a/drivers/fsi/fsi-slave.h +++ b/drivers/fsi/fsi-slave.h @@ -6,6 +6,7 @@ #include #include +#include #define FSI_SLAVE_BASE 0x800 @@ -100,6 +101,7 @@ struct fsi_slave { struct device dev; struct fsi_master *master; struct cdev cdev; + spinlock_t lock; /* atomic access and error recovery */ int cdev_idx; int id; /* FSI address */ int link; /* FSI link# */ From patchwork Thu Feb 15 22:07:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201777 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp151278dyb; Thu, 15 Feb 2024 14:10:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUiyk9PXGL5eEn/EQms4KS9GyOq//7Y/7N8zM13mkTr8ez4NBbHCilo8Kr5BVZy00/hjNPCDJrZuRGS/qparfyKmdG1cg== X-Google-Smtp-Source: AGHT+IHaDkIU3Syup2DyCbsmdd9yUXmp18FVEtsVIdu2ygHvLZ7zzanF3SLq/usdwHJAkT13pmc2 X-Received: by 2002:a05:622a:4c7:b0:42a:b73d:447e with SMTP id q7-20020a05622a04c700b0042ab73d447emr3745661qtx.15.1708035030437; Thu, 15 Feb 2024 14:10:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035030; cv=pass; d=google.com; s=arc-20160816; b=s7fzWWA6jcwP2UdSJ+n6wVlYeqkavvesE1maVn2HSR55K/xsOV40fVOp/lTqzTaBRF e9F3DCBxoI+ZvQ5VwXQ5IaeFF5yIkhjtLKA3rbu+tsovoq3KRD1H4Gv/c+nn/u4CxQEv HOeuPmJpQ/SHYtMIe6c9tRaolydc/VxhwXMIb/py88ZZryPqC2+avZf0A1cQYwAC3DRT sHgTmJcxOpTFsv8uJ5GWkB9N4V1fEfHIyxxO03jrbv1SlaX8miz2mCaG1aj9VCb7ZOWH ACJ51DfzfcOWWbFNXJReHih2paLeL4vV9fN/1EaoBRJQPriA3+kpJJw2ixESL5JagUiT XlLg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=p4Bd0cE5tZZXjGiUwlW/m21TY8wBk8xiigmq9eJjy/8=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=c8K7TF1y6KWKSuv7XP0svA+HpU8tQMLLktKceOF5scv2DmNXA9B91GhyWmc2Q0PHHg CEje8soHHuXed6+afCDpEPHXn7BvC358wPpAViS0ZWS2r1uF56cv98GB+Bd9xKoP6knk ZmCeebx4gaGjoGK6xPzSWysDLc0rWvJO3A/PUa9EdMAioEyGZ5297z+/O5ZjtFqq5JQY KLncE33dO0kwhJ0rCc54xCnGYpcJ6Q/RmzE9e2FsfW6QTI/2rE6ZOM5Soyc2mzBF31eL eyPmr4scyE9aA1JDP40/i3oX1y6qxmlWXeiKmlf0SijgtZoXkgWcld7LKHNbm+WjG9hD YFiw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=GLGaMrg0; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67738-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67738-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id n10-20020ac8674a000000b0042bf9849fc8si2288938qtp.31.2024.02.15.14.10.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:10:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67738-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=GLGaMrg0; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67738-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67738-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4457D1C21C6C for ; Thu, 15 Feb 2024 22:10:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6E2001474D0; Thu, 15 Feb 2024 22:08:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="GLGaMrg0" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3F6913AA41; Thu, 15 Feb 2024 22:08:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034904; cv=none; b=a5rb+9HOI2gy7t7NUAfu/bhuGhukHms/Zl8RsTPYxnno5DzUbjihEINBqppODpFZgmHHJFaxKmX8mB0BjU3I3FGwQ8yYRXQSNGY4mHbD/lkzNQ5MIUFqcdds2WzkR2A/V7gTQjTNcB9kPjnK7gglCLMj1uvyZQMjjqxMFOP1wkE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034904; c=relaxed/simple; bh=g6m8Cm3ROV7efeeZHUrBzY5Km6nC+Ze0oxF+hQuiVzs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mOhITRF4bMkeUIUV7BPnbzn6IvAzqXw53Q7wsQtsjNFHdRxxv38f0oRx47q5ROvIsR17zKCr1kXuWGHgHheust9UZn6xiYIizo4uO8C1UK2svvykob/zEXOBCnbNSjZn4r2laj9gvE83YGxY0JJUurT6fH4YK6iAwqEUSpkPg+o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=GLGaMrg0; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FM7A2d029978; Thu, 15 Feb 2024 22:08:09 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=p4Bd0cE5tZZXjGiUwlW/m21TY8wBk8xiigmq9eJjy/8=; b=GLGaMrg0p4kwI0jPAcxpqxebeEsukU+FGmd866Zjg7zHGFf1HxJUf1qQO7kOLeXV57Rg e9y+nfTgz+X0BZqCTKNoYr6MuKrGIhWy+fyO85rT3Z8n9m8MLvpdgUVka63Ln6HdvECx Efk1bUHlTCDOsBCvticam0Bsoq6IzpRfGp7CtibstvJJyZa6tcZI9ht3l+tFqXMifl39 gVW7W0npVinYA6fqV76b8LJ5nGmP89c0bPPwe2s6AAhKhbsb09FUsue4nYSx11iyPqWy iKET9fwQDyxHnJXOPS0PvKHJz82kB4N7ZtdWN+gV2mXP88IEZcolb8oVCGhApq2kA/bv Rw== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9s0tjy3q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:09 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLN4qc009920; Thu, 15 Feb 2024 22:08:08 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([172.16.1.5]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6p6374qe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:08 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM86BB918236 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:08 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 26AD058061; Thu, 15 Feb 2024 22:08:06 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D8FD558073; Thu, 15 Feb 2024 22:08:05 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:05 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 12/33] fsi: core: Allow cfam device type aliases Date: Thu, 15 Feb 2024 16:07:38 -0600 Message-Id: <20240215220759.976998-13-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 7D2MOM1G1KlY4M5GFPY2YVwo4YalrYB3 X-Proofpoint-ORIG-GUID: 7D2MOM1G1KlY4M5GFPY2YVwo4YalrYB3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 clxscore=1015 suspectscore=0 phishscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004539795575812 X-GMAIL-MSGID: 1791004539795575812 Other FSI devices can uses aliases for the device numbering, so modify the function to get a new minor to allow the cfam type to use aliases too. Signed-off-by: Eddie James --- drivers/fsi/fsi-core.c | 59 +++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index eb15e5f5a2ee..95f6ce81f8f4 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -884,12 +884,37 @@ static int fsi_adjust_index(int index) #endif } -static int __fsi_get_new_minor(struct fsi_slave *slave, enum fsi_dev_type type, - dev_t *out_dev, int *out_index) +static const char *const fsi_dev_type_names[] = { + "cfam", + "sbefifo", + "scom", + "occ", +}; + +static int __fsi_get_new_minor(struct fsi_slave *slave, struct device_node *np, + enum fsi_dev_type type, dev_t *out_dev, int *out_index) { int cid = slave->chip_id; int id; + if (np) { + int aid = of_alias_get_id(np, fsi_dev_type_names[type]); + + if (aid >= 0) { + /* Use the same scheme as the legacy numbers. */ + id = (aid << 2) | type; + id = ida_alloc_range(&fsi_minor_ida, id, id, GFP_KERNEL); + if (id >= 0) { + *out_index = aid; + *out_dev = fsi_base_dev + id; + return 0; + } + + if (id != -ENOSPC) + return id; + } + } + /* Check if we qualify for legacy numbering */ if (cid >= 0 && cid < 16 && type < 4) { /* @@ -918,36 +943,10 @@ 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) { - /* Use the same scheme as the legacy numbers. */ - int id = (aid << 2) | type; - - id = ida_alloc_range(&fsi_minor_ida, id, id, 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); + return __fsi_get_new_minor(fdev->slave, fdev->dev.of_node, type, out_dev, out_index); } EXPORT_SYMBOL_GPL(fsi_get_new_minor); @@ -1052,7 +1051,7 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) } /* Allocate a minor in the FSI space */ - rc = __fsi_get_new_minor(slave, fsi_dev_cfam, &slave->dev.devt, + rc = __fsi_get_new_minor(slave, slave->dev.of_node, fsi_dev_cfam, &slave->dev.devt, &slave->cdev_idx); if (rc) goto err_free; From patchwork Thu Feb 15 22:07:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201807 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp159304dyb; Thu, 15 Feb 2024 14:29:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUvuzO8eQGjTUWuaqONkPwHUdiqk6HQscEcaaFBJ62w49HpBPYYDsNd6QHsul6nSGBYEH2i5Uf+RsdQ2QSA2ccj3I6nXg== X-Google-Smtp-Source: AGHT+IH/uIyZjm1m2ikLMmqnD47XmQTAB7W3mfjES7nVJwa+K9YgY5Wo1RFhgGQAtZK0nMGby7KE X-Received: by 2002:a05:6a21:3949:b0:19e:c304:cfae with SMTP id ac9-20020a056a21394900b0019ec304cfaemr4259062pzc.51.1708036148101; Thu, 15 Feb 2024 14:29:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708036148; cv=pass; d=google.com; s=arc-20160816; b=WDwu83qQyd5Q8zf8ni/1seDuqDHqJ+Zlz04pVRQhKdRlBAsWuQEKen6oAYjMkw0jwM ou7lNKbNi4KXH5AtKXqTf6QdLHJRoqN1lsrC6BTfVpYslGoBMRxiDoIRmx9iHb2kTNEb GroHok6ZOqmNV+nQ2igMxMGWI1a3gs6TiVlo4uV76UsHymCmVHYH6zsc2bxrrZSAQv3A /R8pyvJSN2bSs8ecHC9tU6YkmY3fMNB6jOWUsZx7xFWY3sgiIKZZ009cMYI5WjfDnKkd KzalzNMoaXAYnJPvwfO4qIjobm/bL786iGe6Ti0mayV6rxl75ED2Dkdgg56/Efa1jfJY Sdvw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=nC6nQKgwIVNRNF/ysirTWFmoYra4yeqE06hfgRfw7Bw=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=qj2aEoeZy4CR1/uPbqsjR/5aqMeZdg8QqaSEsCwpqhItK+LDxutqefmXgZqyenZgL9 87ik7f5kNazoqkosqvpUlv97+pUvSWOA5ljGLZtJiwRXloNedz1VojGq18VxA0no5rGG WctPnpwFIeS6PobAQn+sE/GBQGDgOzOAzLC1x5oNPVOl4FZ45KEl3j57wo2WrQMNVPa5 313ILTaN83Z0Jx+gXL0s3v6en1K4buk7NOzmWR3qegHINQgfx5IlfAiQmIsGmFL32MMg 75DB2nguUUZ+dO1ldJ+og45vwa+t9iQvKfkjJZ0A+Ut+kj0Fdd59qsi/8Nv+jkB36b5u ETaA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=TjZ6KKlE; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67763-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67763-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id kq20-20020a056a004b1400b006e0cfe7ad50si1835367pfb.102.2024.02.15.14.29.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:29:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67763-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=TjZ6KKlE; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67763-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67763-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7B9A8B2657A for ; Thu, 15 Feb 2024 22:16:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 23619153BE5; Thu, 15 Feb 2024 22:08:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="TjZ6KKlE" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D58414A4C1; Thu, 15 Feb 2024 22:08:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034916; cv=none; b=QW/cdZYrD+PjAU9MrDu8B0Ykk7bnt9RCUWWuEywE0iPHXWbV94dihxPPude2S/gbaXtcwtPw1EEEL24ajqVksJ+um5xHMbLVc7umgRXVawab+qc/JNCBIHiWhcTCcCGl7KGKcl+LSmcVzgWRsARBuZbbYdLQYc1iduJ8Hy68WhU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034916; c=relaxed/simple; bh=B6y6B9hxIpjalSu4scT5stwo1nniyRvVqX9pFP5A6O0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=P8WJV3twDb3eZZwYHyYUlwoUvBWLGoEmoh/slpElzh8qZAywaF/UIfP8wnibmc0aIM/6/LnZn8b5pIw5MUXYGR6zZvf5m/kP06LeNedEdLAWIKanIgdNCDjn33c+jhFJm2a98jxAmRfWvfI2G+JZMgBIZOxtz3aJTjahOYJVYQg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=TjZ6KKlE; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FLV5IF028067; Thu, 15 Feb 2024 22:08:10 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=nC6nQKgwIVNRNF/ysirTWFmoYra4yeqE06hfgRfw7Bw=; b=TjZ6KKlEUNNd/JLjA5jRMWbNh+gIIw/09DtVrHv1b3xZ1GngHrebVRPjfyogbdqO77h/ IQT7LFpA9E/+CJ3wi/WxNUVchna98OuZ240BBfK6KEr+VBciZ+/esGGxOul5ybkNHw1Q /LXgvZjTaefmEhoFiCBy4//GxpFgO+Fq+KtudvEe21il1XMFBY8niGptj7t7YlQDRGc6 kqq38ffq0EFm1EIsw2fi+oXsr/nUdJ57Mbu1EboxCVEXFCyNehIXEMEIfNEIDXqUx4rI gSDykn2fl8GJGFpuIwAjMvRKynVD22YvzYGNdWZpsvHumqhISsmAjJOrF4ofilyxaFSA rw== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9q8n597e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:10 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FJlBEd016517; Thu, 15 Feb 2024 22:08:09 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([172.16.1.5]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6mymyhc8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:09 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM86nM35782988 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:08 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8F00758077; Thu, 15 Feb 2024 22:08:06 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3948E5807B; Thu, 15 Feb 2024 22:08:06 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:06 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 13/33] fsi: core: Add common regmap master functions Date: Thu, 15 Feb 2024 16:07:39 -0600 Message-Id: <20240215220759.976998-14-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: T7DeW3ZIPTcxULpAgB0Xn3S3Tcr74UPr X-Proofpoint-ORIG-GUID: T7DeW3ZIPTcxULpAgB0Xn3S3Tcr74UPr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=999 impostorscore=0 adultscore=0 suspectscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791005711772873875 X-GMAIL-MSGID: 1791005711772873875 For hardware FSI masters (Aspeed and hub at the moment), the initialization, link enable, and error recovery procedures are common. Add a regmap pointer to the master structure so that master drivers can let the common code handle these procedures. Signed-off-by: Eddie James --- drivers/fsi/Kconfig | 2 + drivers/fsi/fsi-core.c | 161 ++++++++++++++++++++++++++++++++++++- drivers/fsi/fsi-master.h | 16 ++++ include/trace/events/fsi.h | 17 ++++ 4 files changed, 194 insertions(+), 2 deletions(-) diff --git a/drivers/fsi/Kconfig b/drivers/fsi/Kconfig index 79a31593618a..a6760870538d 100644 --- a/drivers/fsi/Kconfig +++ b/drivers/fsi/Kconfig @@ -7,6 +7,7 @@ menuconfig FSI tristate "FSI support" depends on OF select CRC4 + select REGMAP help FSI - the FRU Support Interface - is a simple bus for low-level access to POWER-based hardware. @@ -37,6 +38,7 @@ config FSI_MASTER_GPIO config FSI_MASTER_HUB tristate "FSI hub master" + select REGMAP_FSI help This option enables a FSI hub master driver. Hub is a type of FSI master that is connected to the upstream master via a slave. Hubs diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 95f6ce81f8f4..693e7c51b4af 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -1148,18 +1149,50 @@ static int fsi_master_write(struct fsi_master *master, int link, return rc; } +int fsi_master_link_enable(struct fsi_master *master, int link, bool enable) +{ + u32 msiep = 0x80000000 >> (4 * (link % 8)); + u32 menp = 0x80000000 >> (link % 32); + int enable_idx = 4 * (link / 32); + int irq_idx = 4 * (link / 8); + int rc; + + if (enable) { + rc = regmap_write(master->map, FSI_MSENP0 + enable_idx, menp); + if (rc) + return rc; + + mdelay(FSI_LINK_ENABLE_SETUP_TIME); + + rc = regmap_write(master->map, FSI_MSSIEP0 + irq_idx, msiep); + } else { + rc = regmap_write(master->map, FSI_MCSIEP0 + irq_idx, msiep); + if (rc) + return rc; + + rc = regmap_write(master->map, FSI_MCENP0 + enable_idx, menp); + } + + return rc; +} +EXPORT_SYMBOL_GPL(fsi_master_link_enable); + static int fsi_master_link_disable(struct fsi_master *master, int link) { if (master->link_enable) return master->link_enable(master, link, false); + else if (master->map) + return fsi_master_link_enable(master, link, false); return 0; } -static int fsi_master_link_enable(struct fsi_master *master, int link) +static int _fsi_master_link_enable(struct fsi_master *master, int link) { if (master->link_enable) return master->link_enable(master, link, true); + else if (master->map) + return fsi_master_link_enable(master, link, true); return 0; } @@ -1187,7 +1220,7 @@ static int fsi_master_scan(struct fsi_master *master) trace_fsi_master_scan(master, true); for (link = 0; link < master->n_links; link++) { - rc = fsi_master_link_enable(master, link); + rc = _fsi_master_link_enable(master, link); if (rc) { dev_dbg(&master->dev, "enable link %d failed: %d\n", link, rc); @@ -1284,6 +1317,130 @@ static struct class fsi_master_class = { .dev_groups = master_groups, }; +void fsi_master_error(struct fsi_master *master, int link) +{ + u32 bits = FSI_MMODE_EIP | FSI_MMODE_RELA; + bool mmode = master->mmode & bits; + + if (trace_fsi_master_error_regs_enabled()) { + unsigned int mesrb = 0xffffffff; + unsigned int mstap = 0xffffffff; + + regmap_read(master->map, FSI_MESRB0, &mesrb); + regmap_read(master->map, FSI_MSTAP0 + (link * 4), &mstap); + + trace_fsi_master_error_regs(master->idx, mesrb, mstap); + } + + if (mmode) + regmap_write(master->map, FSI_MMODE, master->mmode & ~bits); + + regmap_write(master->map, FSI_MRESP0, FSI_MRESP_RST_ALL_MASTER); + + if (mmode) + regmap_write(master->map, FSI_MMODE, master->mmode); +} +EXPORT_SYMBOL_GPL(fsi_master_error); + +static inline u32 fsi_mmode_crs0(u32 x) +{ + return (x & FSI_MMODE_CRS0MASK) << FSI_MMODE_CRS0SHFT; +} + +static inline u32 fsi_mmode_crs1(u32 x) +{ + return (x & FSI_MMODE_CRS1MASK) << FSI_MMODE_CRS1SHFT; +} + +int fsi_master_init(struct fsi_master *master, unsigned long parent_clock_frequency) +{ + unsigned int mlevp; + unsigned int maeb; + int div = 1; + int rc; + + if (parent_clock_frequency) { + u32 clock_frequency = parent_clock_frequency; + + if (!device_property_read_u32(&master->dev, "clock-frequency", &clock_frequency)) { + if (!clock_frequency) + clock_frequency = parent_clock_frequency; + } + + div = (parent_clock_frequency + (clock_frequency - 1)) / clock_frequency; + master->clock_frequency = parent_clock_frequency / div; + } + + rc = regmap_write(master->map, FSI_MRESP0, FSI_MRESP_RST_ALL_MASTER | + FSI_MRESP_RST_ALL_LINK | FSI_MRESP_RST_MCR | FSI_MRESP_RST_PYE); + if (rc) + return rc; + + rc = regmap_write(master->map, FSI_MECTRL, FSI_MECTRL_EOAE | FSI_MECTRL_P8_AUTO_TERM); + if (rc) + return rc; + + master->mmode = FSI_MMODE_ECRC | FSI_MMODE_EPC | fsi_mmode_crs0(div) | + fsi_mmode_crs1(div) | FSI_MMODE_P8_TO_LSB; + rc = regmap_write(master->map, FSI_MMODE, master->mmode); + if (rc) + return rc; + + rc = regmap_write(master->map, FSI_MDLYR, 0xffff0000); + if (rc) + return rc; + + rc = regmap_write(master->map, FSI_MSENP0, 0xffffffff); + if (rc) + return rc; + + mdelay(FSI_LINK_ENABLE_SETUP_TIME); + + rc = regmap_write(master->map, FSI_MCENP0, 0xffffffff); + if (rc) + return rc; + + rc = regmap_read(master->map, FSI_MAEB, &maeb); + if (rc) + return rc; + + rc = regmap_write(master->map, FSI_MRESP0, FSI_MRESP_RST_ALL_MASTER | + FSI_MRESP_RST_ALL_LINK); + if (rc) + return rc; + + rc = regmap_read(master->map, FSI_MLEVP0, &mlevp); + if (rc) + return rc; + + rc = regmap_write(master->map, FSI_MRESB0, FSI_MRESB_RST_GEN); + if (rc) + return rc; + + rc = regmap_write(master->map, FSI_MRESB0, FSI_MRESB_RST_ERR); + if (rc) + return rc; + + if (master->flags & FSI_MASTER_FLAG_INTERRUPT) + master->mmode |= FSI_MMODE_EIP; + if (master->flags & FSI_MASTER_FLAG_RELA) + master->mmode |= FSI_MMODE_RELA; + return regmap_write(master->map, FSI_MMODE, master->mmode); +} +EXPORT_SYMBOL_GPL(fsi_master_init); + +void fsi_master_regmap_config(struct regmap_config *config) +{ + config->reg_bits = 32; + config->val_bits = 32; + config->disable_locking = true; // master driver will lock + config->fast_io = true; + config->cache_type = REGCACHE_NONE; + config->val_format_endian = REGMAP_ENDIAN_NATIVE; + config->can_sleep = false; +} +EXPORT_SYMBOL_GPL(fsi_master_regmap_config); + int fsi_master_register(struct fsi_master *master) { int rc; diff --git a/drivers/fsi/fsi-master.h b/drivers/fsi/fsi-master.h index 26e636ad9ef6..f4cecdff3834 100644 --- a/drivers/fsi/fsi-master.h +++ b/drivers/fsi/fsi-master.h @@ -27,6 +27,9 @@ #define FSI_MLEVP0 0x18 /* R: plug detect */ #define FSI_MSENP0 0x18 /* S: Set enable */ #define FSI_MCENP0 0x20 /* C: Clear enable */ +#define FSI_MSIEP0 0x30 /* R/W: interrupt enable */ +#define FSI_MSSIEP0 0x50 /* S: Set interrupt enable */ +#define FSI_MCSIEP0 0x70 /* C: Clear interrupt enable */ #define FSI_MAEB 0x70 /* R: Error address */ #define FSI_MVER 0x74 /* R: master version/type */ #define FSI_MSTAP0 0xd0 /* R: Port status */ @@ -108,9 +111,15 @@ /* Misc */ #define FSI_CRC_SIZE 4 +#define FSI_LINK_ENABLE_SETUP_TIME 10 /* in mS */ /* fsi-master definition and flags */ #define FSI_MASTER_FLAG_SWCLOCK 0x1 +#define FSI_MASTER_FLAG_INTERRUPT 0x2 +#define FSI_MASTER_FLAG_RELA 0x4 + +struct regmap; +struct regmap_config; /* * Structures and function prototypes @@ -120,6 +129,8 @@ struct fsi_master { struct device dev; + struct regmap *map; + u32 mmode; unsigned long clock_frequency; int lbus_divider; int idx; @@ -140,6 +151,11 @@ struct fsi_master { #define to_fsi_master(d) container_of(d, struct fsi_master, dev) +void fsi_master_error(struct fsi_master *master, int link); +int fsi_master_init(struct fsi_master *master, unsigned long parent_clock_frequency); +int fsi_master_link_enable(struct fsi_master *master, int link, bool enable); +void fsi_master_regmap_config(struct regmap_config *config); + /** * fsi_master registration & lifetime: the fsi_master_register() and * fsi_master_unregister() functions will take ownership of the master, and diff --git a/include/trace/events/fsi.h b/include/trace/events/fsi.h index 5509afc98ee8..da977d59e163 100644 --- a/include/trace/events/fsi.h +++ b/include/trace/events/fsi.h @@ -67,6 +67,23 @@ TRACE_EVENT(fsi_master_error, &__entry->data, __entry->ret) ); +TRACE_EVENT(fsi_master_error_regs, + TP_PROTO(int master_idx, uint32_t mesrb, uint32_t mstap), + TP_ARGS(master_idx, mesrb, mstap), + TP_STRUCT__entry( + __field(int, master_idx) + __field(uint32_t, mesrb) + __field(uint32_t, mstap) + ), + TP_fast_assign( + __entry->master_idx = master_idx; + __entry->mesrb = mesrb; + __entry->mstap = mstap; + ), + TP_printk("fsi%d mesrb:%08x mstap:%08x", __entry->master_idx, __entry->mesrb, + __entry->mstap) +); + TRACE_EVENT(fsi_master_break, TP_PROTO(const struct fsi_master *master, int link), TP_ARGS(master, link), From patchwork Thu Feb 15 22:07:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201809 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp159791dyb; Thu, 15 Feb 2024 14:30:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXurDAJJ7zrPsqU8M9FiwipH8JCdjbgmy5U90apWKsE2w1qoXrwQ0usiJr6MHk1Fq24E87GgzvhAab5WrsH30DLnySqoQ== X-Google-Smtp-Source: AGHT+IFVhXKVNKOLWFObXOAnGpZpOSHJ026gYtZx/j6mj/V8xIHkZQDxbecZ0BAh0VWb6OUhfiOO X-Received: by 2002:a05:6a21:150a:b0:19e:b477:33a4 with SMTP id nq10-20020a056a21150a00b0019eb47733a4mr4243527pzb.27.1708036218466; Thu, 15 Feb 2024 14:30:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708036218; cv=pass; d=google.com; s=arc-20160816; b=PL6z+t5Atcc4kZQLs5tcqoNjFgXEWzRd9PXYJQs1MYyQiYbow49yZjvaMyfY14bS49 K25douvb6t8FGYd/xvy5CqLFjJJkOCUs3JwLwocFHzQXSpFj+xQ0XVacyoznpFaNVz2s h7G+5r0kKB5nQmsexQ0Ej9kxT72ewQkahIkLMNowdjXt+Ioyu9irc53ABrY+y7PPgGoe 0JAtsWaQaPzcQuARRaee0Ob+kGsYxfOy5XBJGYhoyEnGPbGtZV5b5A/cRml9+/FzPNUL mXLK73FKkEZ3wc+5vhv8La0n5h6LmQy+TFs+umsR032IFeMi4jhZb5WmnuheOKtQD072 RGbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zrnHDAhdPUnbtmjsykKg9BbRlBjR1tZ8tUSGR8/dp0k=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=galuH0XkKIkvNC+J2FaSkAvBRI9/d0DaEMqADjtrvP4TJt/Xa0/v/O+di6avB42qv5 M7110MmquOPCRY+C33aubEXj7j3GvtFVbxCjPZziUUNGyjlAQpuNnWyYyd9/ngOxTudx MzzqeJ2FQEfYBs0Yn5aLwtoMXwf/erAH0SGu80718gyRPL7ql9SY/ywEZC6ed0W8zWLD /WKZ81LWGrCyesJUxUQhUL2Ru03TIfQoxAoebL5MH6vvn32Slhm6ysnUq3XimMEJFlg7 UIeDRkRyZVUaut3euyScm+Q2z2Qi5XXcqGqfc7WttAI/8ZjlRua1Sv/XPz3ZN2snoRZ+ MxNA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Jj+LmhxR; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67766-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67766-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id y18-20020a637d12000000b005dca7d50880si1795353pgc.696.2024.02.15.14.30.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:30:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67766-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Jj+LmhxR; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67766-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67766-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BAC11B2684F for ; Thu, 15 Feb 2024 22:17:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F128154445; Thu, 15 Feb 2024 22:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Jj+LmhxR" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C8311474C1; Thu, 15 Feb 2024 22:08:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034921; cv=none; b=ii2NG30ceN6b840RH3eMKbOgvzrpw5tbLDEsjCLpFzVp5gJ2aBmuqCOwFRkVfIWMMrN1fdv5hoJgTd4FkmX3Zee9m/Z/m9FhqVV1CzI1b14mYss7j9qZUf+g6nM3+20bb3zS1AKB1iyHcmfiEneKtidgKPuOQ7tdKt0AH/pLRyA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034921; c=relaxed/simple; bh=3nimcBkyHMSfym8s4tUd4i+bP6FP4+nFWT7XoE1U7e0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=arqa/8F1ymIyL0hZqN4t1Ih5BvqXk0x7RNlSxkHQW79Z9aRwFSMkLsW9Y1C2uaC35AELDm0bh6o0jOus8usm6jZCwIsfl8heFLkh5IBkDU14XoBwU3aXZNuHYZudIZcCi72LwXztMfawtqH8Ak2NuOAQwVlGoQb6A9eRdUV/e5M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=Jj+LmhxR; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FL0nM9010649; Thu, 15 Feb 2024 22:08:10 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=zrnHDAhdPUnbtmjsykKg9BbRlBjR1tZ8tUSGR8/dp0k=; b=Jj+LmhxRNdBuAR/1xT1pcGhL5Twy853ojKYf36tPXN1ZObIhuetJTG1ea7adSNuQobNl 1Hu106y2tWn08gVBKrBDxB9RHGrG3y3CRIQC92PWycWFjFKkm8KKL1Cg+B1+etRaW464 ts40lbY7KX8Oq9cvfwWdjKOo8hkTuYmgltZ62prWzMMw7FHtN5N+f5jndzsHrqf8qeW5 nJunvgDMPp28cZHT5fiVsVeTBzOVT3Ef+gW0aeXnzy7jxox9rpBvNvusWbMTAz1t2k2S zZalbQFamA4Acc6HP+g1f0TQGddf9/SKs9hMs8vNfEPc9sy93jPvDcaNLuwtK7lmM2xD Fw== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9q8n597p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:10 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FJfrBV016479; Thu, 15 Feb 2024 22:08:09 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6mymyhc9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:09 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM87OO5505808 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:09 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E88ED5807D; Thu, 15 Feb 2024 22:08:06 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9860058064; Thu, 15 Feb 2024 22:08:06 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:06 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 14/33] fsi: hub: Use common initialization and link enable Date: Thu, 15 Feb 2024 16:07:40 -0600 Message-Id: <20240215220759.976998-15-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: iOVfYgi2tLwUNzLc3aTC_wQ4cdI-SGai X-Proofpoint-ORIG-GUID: iOVfYgi2tLwUNzLc3aTC_wQ4cdI-SGai X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=809 impostorscore=0 adultscore=0 suspectscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791005785808126793 X-GMAIL-MSGID: 1791005785808126793 Set up an FSI regmap for the hub master to use the new common master initialization and link enable procedures. Signed-off-by: Eddie James --- drivers/fsi/fsi-master-hub.c | 141 ++++++----------------------------- 1 file changed, 23 insertions(+), 118 deletions(-) diff --git a/drivers/fsi/fsi-master-hub.c b/drivers/fsi/fsi-master-hub.c index 111bf7a11458..92aa07055c56 100644 --- a/drivers/fsi/fsi-master-hub.c +++ b/drivers/fsi/fsi-master-hub.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "fsi-master.h" @@ -16,8 +17,6 @@ #define FSI_ENGID_HUB_MASTER 0x1c -#define FSI_LINK_ENABLE_SETUP_TIME 10 /* in mS */ - /* * FSI hub master support * @@ -78,134 +77,33 @@ static int hub_master_break(struct fsi_master *master, int link) return hub_master_write(master, link, 0, addr, &cmd, sizeof(cmd)); } -static int hub_master_link_enable(struct fsi_master *master, int link, - bool enable) -{ - struct fsi_master_hub *hub = to_fsi_master_hub(master); - int idx, bit; - __be32 reg; - int rc; - - idx = link / 32; - bit = link % 32; - - reg = cpu_to_be32(0x80000000 >> bit); - - if (!enable) - return fsi_device_write(hub->upstream, FSI_MCENP0 + (4 * idx), - ®, 4); - - rc = fsi_device_write(hub->upstream, FSI_MSENP0 + (4 * idx), ®, 4); - if (rc) - return rc; - - mdelay(FSI_LINK_ENABLE_SETUP_TIME); - - return 0; -} - static void hub_master_release(struct device *dev) { struct fsi_master_hub *hub = to_fsi_master_hub(to_fsi_master(dev)); + regmap_exit(hub->master.map); kfree(hub); } -/* mmode encoders */ -static inline u32 fsi_mmode_crs0(u32 x) -{ - return (x & FSI_MMODE_CRS0MASK) << FSI_MMODE_CRS0SHFT; -} - -static inline u32 fsi_mmode_crs1(u32 x) -{ - return (x & FSI_MMODE_CRS1MASK) << FSI_MMODE_CRS1SHFT; -} - -static int hub_master_init(struct fsi_master_hub *hub) -{ - struct fsi_device *dev = hub->upstream; - __be32 reg; - int rc; - - reg = cpu_to_be32(FSI_MRESP_RST_ALL_MASTER | FSI_MRESP_RST_ALL_LINK - | FSI_MRESP_RST_MCR | FSI_MRESP_RST_PYE); - rc = fsi_device_write(dev, FSI_MRESP0, ®, sizeof(reg)); - if (rc) - return rc; - - /* Initialize the MFSI (hub master) engine */ - reg = cpu_to_be32(FSI_MRESP_RST_ALL_MASTER | FSI_MRESP_RST_ALL_LINK - | FSI_MRESP_RST_MCR | FSI_MRESP_RST_PYE); - rc = fsi_device_write(dev, FSI_MRESP0, ®, sizeof(reg)); - if (rc) - return rc; - - reg = cpu_to_be32(FSI_MECTRL_EOAE | FSI_MECTRL_P8_AUTO_TERM); - rc = fsi_device_write(dev, FSI_MECTRL, ®, sizeof(reg)); - if (rc) - return rc; - - reg = cpu_to_be32(FSI_MMODE_EIP | FSI_MMODE_ECRC | FSI_MMODE_EPC - | fsi_mmode_crs0(1) | fsi_mmode_crs1(1) - | FSI_MMODE_P8_TO_LSB); - rc = fsi_device_write(dev, FSI_MMODE, ®, sizeof(reg)); - if (rc) - return rc; - - reg = cpu_to_be32(0xffff0000); - rc = fsi_device_write(dev, FSI_MDLYR, ®, sizeof(reg)); - if (rc) - return rc; - - reg = cpu_to_be32(~0); - rc = fsi_device_write(dev, FSI_MSENP0, ®, sizeof(reg)); - if (rc) - return rc; - - /* Leave enabled long enough for master logic to set up */ - mdelay(FSI_LINK_ENABLE_SETUP_TIME); - - rc = fsi_device_write(dev, FSI_MCENP0, ®, sizeof(reg)); - if (rc) - return rc; - - rc = fsi_device_read(dev, FSI_MAEB, ®, sizeof(reg)); - if (rc) - return rc; - - reg = cpu_to_be32(FSI_MRESP_RST_ALL_MASTER | FSI_MRESP_RST_ALL_LINK); - rc = fsi_device_write(dev, FSI_MRESP0, ®, sizeof(reg)); - if (rc) - return rc; - - rc = fsi_device_read(dev, FSI_MLEVP0, ®, sizeof(reg)); - if (rc) - return rc; - - /* Reset the master bridge */ - reg = cpu_to_be32(FSI_MRESB_RST_GEN); - rc = fsi_device_write(dev, FSI_MRESB0, ®, sizeof(reg)); - if (rc) - return rc; - - reg = cpu_to_be32(FSI_MRESB_RST_ERR); - return fsi_device_write(dev, FSI_MRESB0, ®, sizeof(reg)); -} - static int hub_master_probe(struct device *dev) { + struct regmap_config hub_master_regmap_config; struct fsi_device *fsi_dev = to_fsi_dev(dev); struct fsi_master_hub *hub; + struct regmap *map; uint32_t reg, links; - __be32 __reg; int rc; - rc = fsi_device_read(fsi_dev, FSI_MVER, &__reg, sizeof(__reg)); + fsi_master_regmap_config(&hub_master_regmap_config); + hub_master_regmap_config.reg_base = fsi_dev->addr; + map = regmap_init_fsi(fsi_dev, &hub_master_regmap_config); + if (IS_ERR(map)) + return PTR_ERR(map); + + rc = regmap_read(map, FSI_MVER, ®); if (rc) - return rc; + goto err_regmap; - reg = be32_to_cpu(__reg); links = (reg >> 8) & 0xff; dev_dbg(dev, "hub version %08x (%d links)\n", reg, links); @@ -213,7 +111,7 @@ static int hub_master_probe(struct device *dev) FSI_HUB_LINK_SIZE * links); if (rc) { dev_err(dev, "can't claim slave address range for links"); - return rc; + goto err_regmap; } hub = kzalloc(sizeof(*hub), GFP_KERNEL); @@ -229,22 +127,25 @@ static int hub_master_probe(struct device *dev) hub->master.dev.parent = dev; hub->master.dev.release = hub_master_release; hub->master.dev.of_node = of_node_get(dev_of_node(dev)); + hub->master.map = map; hub->master.lbus_divider = 1; hub->master.idx = fsi_dev->slave->link + 1; hub->master.n_links = links; + hub->master.flags = FSI_MASTER_FLAG_INTERRUPT; hub->master.read = hub_master_read; hub->master.write = hub_master_write; hub->master.send_break = hub_master_break; - hub->master.link_enable = hub_master_link_enable; dev_set_drvdata(dev, hub); - hub_master_init(hub); + rc = fsi_master_init(&hub->master, fsi_device_local_bus_frequency(fsi_dev)); + if (rc) + goto err_free; rc = fsi_master_register(&hub->master); if (rc) - goto err_release; + goto err_free; /* At this point, fsi_master_register performs the device_initialize(), * and holds the sole reference on master.dev. This means the device @@ -256,9 +157,13 @@ static int hub_master_probe(struct device *dev) get_device(&hub->master.dev); return 0; +err_free: + kfree(hub); err_release: fsi_slave_release_range(fsi_dev->slave, FSI_HUB_LINK_OFFSET, FSI_HUB_LINK_SIZE * links); +err_regmap: + regmap_exit(map); return rc; } From patchwork Thu Feb 15 22:07:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201806 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp159074dyb; Thu, 15 Feb 2024 14:28:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW36SW1YK3E+80q6HmyTYLPpmzfbYTJ+aV4MUsRKRolXC6m22VKNbDXXVz5JoHOFXO2Ci4EbXkfZd5t7grqpNIuh1GWww== X-Google-Smtp-Source: AGHT+IHizg0JgBIjVXy7lzAb+Wdc+WCgio9kiW7mbQpe/h91JWTQPldGbrBYt1ue4QlIwZzAvqJS X-Received: by 2002:a17:90a:e392:b0:296:a75e:d1de with SMTP id b18-20020a17090ae39200b00296a75ed1demr2966277pjz.12.1708036110668; Thu, 15 Feb 2024 14:28:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708036110; cv=pass; d=google.com; s=arc-20160816; b=LGPObHwtW/CFJ+A0ozXNAkBPkbFBNLQq3jJs7WoFiUAgWDN/OcckPpcBVMcVdgwp5O vtgBnw8+sIuHXnxlGAa2OG1K6zP/mzAfg9lULI7+82hcea6V18DRj6tItoB5oh7Zyp7L Xx+/nzmFNFMg9Fev1acAEFfgB4gvhxmk9qVzKr88wZT4QERjeNipqq8UHM6F7Ec8CDR7 0Bpe/8n5d0iYpdq/a42bVzTCbg4N1uyKx0Dxg5+5pds61iloW/d1wbnq/S3Vo7xpGVSy pWpYsUFYf9vOopiu8wNJ7009pqPOG9eOfZg9/9mSMBk8G0qtjqE8r42T1tHj+672Yu3R l12w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Wt8UWHHJz1+fM4oAB+F4OGgkDBnjm6htdEah2gI4GTI=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=uIQk/IvTb7eXoP2/Sfe6qXilEBxpr5vz9kd3XORg5FQgVmMg6Mu7jMNz0qxuH0+QOl hWmo1cDfrbLjPxTw1KnJGvZvBJF/6ofT/NmPCsG4bD+PDzDCqSxT7qKiuXLlktZzzae1 9Ty2hajOLiZquKUX2CcJC+p6CXk4aKPNfUzm9/p8R5AUmMvs6N4CgAK6iXWapfm0KF6y dgnAg9h5cYv5OyjqzhJdHkyYgAV5gnNy6M4YoIwy4P1KUx/WddLffgQxJ4QxvQ8UgtsX W9eFngfnFCdU8iCetJ5+2QtNrohAxegRdUDvnAfsm1qAiOE2nfjRLF1YzQNurPORuX4o PgtA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=oC0g9rws; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67760-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67760-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id ck22-20020a17090afe1600b00296e784edc5si3717402pjb.144.2024.02.15.14.28.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:28:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67760-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=oC0g9rws; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67760-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67760-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 77A61B25268 for ; Thu, 15 Feb 2024 22:16:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29D61153BC3; Thu, 15 Feb 2024 22:08:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="oC0g9rws" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABB4514AD09; Thu, 15 Feb 2024 22:08:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034915; cv=none; b=UpSLGWd6jmuETuFAPDyFJlaYl82CkajzGPj1H4rHbMJ8wqIu7G0zFaaxvgEg+JUpvht4S6JsfjB4GE48JUuD+M9funKTdvwuiYPZpzb0XkoK5+ukgQqZRkDcoCGT9XWbFIo6wKqaqTWTRs/xoByNfUCwjuY04idbjHeAasFWur8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034915; c=relaxed/simple; bh=06noxcBj+0w/9K5t6WqaO8FUweWGJp65GITzL1ijo5s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=C7JRisTjMgM8V2lfzlT4mV0WLwyro8Z4tFejei160HTq0boXLflMHPTcl6zdt9Ac9RudXCJno8iNtXzBrODC18CSkJ0lp8eYzMLhPqQo5oe5dftup2gm2WhHwHuSNSi4qtTkaai4Odt6m850nb5/CmziNawnZMO3Hz7xDbs1GKk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=oC0g9rws; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FKOjUR002615; Thu, 15 Feb 2024 22:08:11 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=Wt8UWHHJz1+fM4oAB+F4OGgkDBnjm6htdEah2gI4GTI=; b=oC0g9rwsdqskmLoHwJx+0YT9SgwiUPsVDzhidXY8JRRBRP8zp9I67nnr1vzjVetyeO0L rcDhtyRDqXhQJyRq/WMrncm5hTXxqbOmjlcTtMrGvqPfEk92sl8AVjbZ73YVEHLpXZ0D W0cVghZUP4lYpA4O9okmgP+LPhkExcxmpQWG5cb/jzlBiwThw8ToJKw96txWK1iIjgMn kFUaP76npTnpHN28Cge/VjP5wtDxTNZ9MSft504KJBqr/uNerb6xemP0juNgzDcFvkC1 PMFhgcNV4lToDOcYiH+Jv6HBNpZ1+6pXq/mq+DywaCtFB0apLaVqGtSrL3xUTZzbmXx+ vQ== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9q8n597q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:10 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FJAQbI032596; Thu, 15 Feb 2024 22:08:09 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6kftyudx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:09 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM87v914025408 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:09 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5114058071; Thu, 15 Feb 2024 22:08:07 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F165E58089; Thu, 15 Feb 2024 22:08:06 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:06 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 15/33] fsi: aspeed: Use common initialization and link enable Date: Thu, 15 Feb 2024 16:07:41 -0600 Message-Id: <20240215220759.976998-16-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: PpaRy4Hms_6nZR2-KaVSngRSZgIV4Kzk X-Proofpoint-ORIG-GUID: PpaRy4Hms_6nZR2-KaVSngRSZgIV4Kzk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=999 impostorscore=0 adultscore=0 suspectscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791005672907433102 X-GMAIL-MSGID: 1791005672907433102 Create a regmap for accessing the master registers over OPB to use the new common master initialization and link enable procedures. Signed-off-by: Eddie James --- drivers/fsi/fsi-master-aspeed.c | 146 ++++++++------------------------ 1 file changed, 37 insertions(+), 109 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index d6e923b8f501..2258980e4c47 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -90,14 +90,6 @@ static const u32 fsi_base = 0xa0000000; #define CREATE_TRACE_POINTS #include -#define FSI_LINK_ENABLE_SETUP_TIME 10 /* in mS */ - -/* Run the bus at maximum speed by default */ -#define FSI_DIVISOR_DEFAULT 1 -#define FSI_DIVISOR_CABLED 2 -static u16 aspeed_fsi_divisor = FSI_DIVISOR_DEFAULT; -module_param_named(bus_div,aspeed_fsi_divisor, ushort, 0); - #define OPB_POLL_TIMEOUT 500 static int __opb_write(struct fsi_master_aspeed *aspeed, u32 addr, @@ -328,35 +320,6 @@ static int aspeed_master_write(struct fsi_master *master, int link, return ret; } -static int aspeed_master_link_enable(struct fsi_master *master, int link, - bool enable) -{ - struct fsi_master_aspeed *aspeed = to_fsi_master_aspeed(master); - int idx, bit, ret; - __be32 reg; - - idx = link / 32; - bit = link % 32; - - reg = cpu_to_be32(0x80000000 >> bit); - - mutex_lock(&aspeed->lock); - - if (!enable) { - ret = opb_writel(aspeed, ctrl_base + FSI_MCENP0 + (4 * idx), reg); - goto done; - } - - ret = opb_writel(aspeed, ctrl_base + FSI_MSENP0 + (4 * idx), reg); - if (ret) - goto done; - - mdelay(FSI_LINK_ENABLE_SETUP_TIME); -done: - mutex_unlock(&aspeed->lock); - return ret; -} - static int aspeed_master_term(struct fsi_master *master, int link, uint8_t id) { uint32_t addr; @@ -384,72 +347,33 @@ static void aspeed_master_release(struct device *dev) struct fsi_master_aspeed *aspeed = to_fsi_master_aspeed(to_fsi_master(dev)); + regmap_exit(aspeed->master.map); kfree(aspeed); } -/* mmode encoders */ -static inline u32 fsi_mmode_crs0(u32 x) +static int regmap_aspeed_opb_read(void *context, unsigned int reg, unsigned int *val) { - return (x & FSI_MMODE_CRS0MASK) << FSI_MMODE_CRS0SHFT; -} + __be32 v; + int ret; -static inline u32 fsi_mmode_crs1(u32 x) -{ - return (x & FSI_MMODE_CRS1MASK) << FSI_MMODE_CRS1SHFT; + ret = opb_readl(context, ctrl_base + reg, &v); + if (ret) + return ret; + + *val = be32_to_cpu(v); + return 0; } -static int aspeed_master_init(struct fsi_master_aspeed *aspeed) +static int regmap_aspeed_opb_write(void *context, unsigned int reg, unsigned int val) { - __be32 reg; - - reg = cpu_to_be32(FSI_MRESP_RST_ALL_MASTER | FSI_MRESP_RST_ALL_LINK - | FSI_MRESP_RST_MCR | FSI_MRESP_RST_PYE); - opb_writel(aspeed, ctrl_base + FSI_MRESP0, reg); - - /* Initialize the MFSI (hub master) engine */ - reg = cpu_to_be32(FSI_MRESP_RST_ALL_MASTER | FSI_MRESP_RST_ALL_LINK - | FSI_MRESP_RST_MCR | FSI_MRESP_RST_PYE); - opb_writel(aspeed, ctrl_base + FSI_MRESP0, reg); - - reg = cpu_to_be32(FSI_MECTRL_EOAE | FSI_MECTRL_P8_AUTO_TERM); - opb_writel(aspeed, ctrl_base + FSI_MECTRL, reg); - - reg = cpu_to_be32(FSI_MMODE_ECRC | FSI_MMODE_EPC | FSI_MMODE_RELA - | fsi_mmode_crs0(aspeed_fsi_divisor) - | fsi_mmode_crs1(aspeed_fsi_divisor) - | FSI_MMODE_P8_TO_LSB); - dev_info(aspeed->dev, "mmode set to %08x (divisor %d)\n", - be32_to_cpu(reg), aspeed_fsi_divisor); - opb_writel(aspeed, ctrl_base + FSI_MMODE, reg); - - reg = cpu_to_be32(0xffff0000); - opb_writel(aspeed, ctrl_base + FSI_MDLYR, reg); - - reg = cpu_to_be32(~0); - opb_writel(aspeed, ctrl_base + FSI_MSENP0, reg); - - /* Leave enabled long enough for master logic to set up */ - mdelay(FSI_LINK_ENABLE_SETUP_TIME); - - opb_writel(aspeed, ctrl_base + FSI_MCENP0, reg); - - opb_readl(aspeed, ctrl_base + FSI_MAEB, NULL); - - reg = cpu_to_be32(FSI_MRESP_RST_ALL_MASTER | FSI_MRESP_RST_ALL_LINK); - opb_writel(aspeed, ctrl_base + FSI_MRESP0, reg); - - opb_readl(aspeed, ctrl_base + FSI_MLEVP0, NULL); - - /* Reset the master bridge */ - reg = cpu_to_be32(FSI_MRESB_RST_GEN); - opb_writel(aspeed, ctrl_base + FSI_MRESB0, reg); - - reg = cpu_to_be32(FSI_MRESB_RST_ERR); - opb_writel(aspeed, ctrl_base + FSI_MRESB0, reg); - - return 0; + return opb_writel(context, ctrl_base + reg, cpu_to_be32(val)); } +static const struct regmap_bus regmap_aspeed_opb = { + .reg_write = regmap_aspeed_opb_write, + .reg_read = regmap_aspeed_opb_read, +}; + static ssize_t cfam_reset_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { @@ -521,14 +445,6 @@ static int tacoma_cabled_fsi_fixup(struct device *dev) /* If the routing GPIO is high we should set the mux to low. */ if (gpio) { - /* - * Cable signal integrity means we should run the bus - * slightly slower. Do not override if a kernel param - * has already overridden. - */ - if (aspeed_fsi_divisor == FSI_DIVISOR_DEFAULT) - aspeed_fsi_divisor = FSI_DIVISOR_CABLED; - gpiod_direction_output(mux_gpio, 0); dev_info(dev, "FSI configured for external cable\n"); } else { @@ -544,9 +460,10 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) { const struct fsi_master_aspeed_data *md = of_device_get_match_data(&pdev->dev); u32 opb_retry_counter = md ? md->opb_retry_counter : OPB_RETRY_COUNTER_AST2600; + struct regmap_config aspeed_master_regmap_config; struct fsi_master_aspeed *aspeed; - int rc, links, reg; - __be32 raw; + unsigned int reg; + int rc, links; rc = tacoma_cabled_fsi_fixup(&pdev->dev); if (rc) { @@ -606,13 +523,20 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) */ writel(0x1, aspeed->base + OPB0_SELECT); - rc = opb_readl(aspeed, ctrl_base + FSI_MVER, &raw); + fsi_master_regmap_config(&aspeed_master_regmap_config); + aspeed->master.map = regmap_init(&pdev->dev, ®map_aspeed_opb, aspeed, + &aspeed_master_regmap_config); + if (IS_ERR(aspeed->master.map)) { + rc = PTR_ERR(aspeed->master.map); + goto err_release; + } + + rc = regmap_read(aspeed->master.map, FSI_MVER, ®); if (rc) { dev_err(&pdev->dev, "failed to read hub version\n"); - goto err_release; + goto err_regmap; } - reg = be32_to_cpu(raw); links = (reg >> 8) & 0xff; dev_info(&pdev->dev, "hub version %08x (%d links)\n", reg, links); @@ -621,20 +545,22 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) aspeed->master.dev.of_node = of_node_get(dev_of_node(&pdev->dev)); aspeed->master.n_links = links; + aspeed->master.flags = FSI_MASTER_FLAG_RELA; aspeed->master.read = aspeed_master_read; aspeed->master.write = aspeed_master_write; aspeed->master.send_break = aspeed_master_break; aspeed->master.term = aspeed_master_term; - aspeed->master.link_enable = aspeed_master_link_enable; dev_set_drvdata(&pdev->dev, aspeed); mutex_init(&aspeed->lock); - aspeed_master_init(aspeed); + rc = fsi_master_init(&aspeed->master, clk_get_rate(aspeed->clk)); + if (rc) + goto err_regmap; rc = fsi_master_register(&aspeed->master); if (rc) - goto err_release; + goto err_regmap; /* At this point, fsi_master_register performs the device_initialize(), * and holds the sole reference on master.dev. This means the device @@ -646,6 +572,8 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) get_device(&aspeed->master.dev); return 0; +err_regmap: + regmap_exit(aspeed->master.map); err_release: clk_disable_unprepare(aspeed->clk); err_free_aspeed: From patchwork Thu Feb 15 22:07:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201786 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp152770dyb; Thu, 15 Feb 2024 14:13:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWYjNbJKeRw4PiVrgHuvW9PQVqpeccS5QyDm0kb2nkitSJjFsiEHoj1uQPRRuV4EP0Gy2jurYei6kz1LaeXeab5U8EfxA== X-Google-Smtp-Source: AGHT+IEAGAgEVGQvwwzhxDD2f71Z7Q30JnHImQjUImaE/H/Ym2g1DY5gsuI9qSXXD9QfJf8n/N3T X-Received: by 2002:a05:620a:2158:b0:787:197a:981a with SMTP id m24-20020a05620a215800b00787197a981amr3040752qkm.46.1708035234368; Thu, 15 Feb 2024 14:13:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035234; cv=pass; d=google.com; s=arc-20160816; b=NmEHgxMzUP/HQhNnTzh4aaU4t+ytpUbTWWHgNuWIHWQNWPcXLVVLhOFsU/CRS2Hz6E nYkGj4EvzgkKK6lkZctj2WhWaokVdOjQpS0XZEPhQ79g6EMBzvdwZtWwGqXx+eM9c9Vx H2EJfR2iMt0iYSoCPtAXXXlWhgVsolgwIMTZko3ouuM+ktWg1/EAPrNx2CB1cT57SGEW PMSa7zBGkMkBqar9WN2m0LYCeU6RDzU0L+irhhpqSwSpJTQVapUnYzFc5x2AjWHq4lwf /vcCmcyx4V5n0K+z5qaF+HFG2VchJa7/MTD2GwC4c+o02DUWVtuo1yRKzdRKk25zjxkW gPAw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=BoYmg2I4Q0k+a3TaU4ABCYR9yHgcAHY+742VsQ7xQZc=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=PgiNRlBYepgNlST0OyyzJHX4D9vvrqueZ6vicG5b4JKgrbZ4zz+59UbhPvb7X+4rxA nGXpBP3b5bKBPnxoBWPOWYiz1Ok5LWU/rqkaHL2uad02SWCnfKxIb5AYHrrOv/qIzP+U PiW0o+V4oOa8X7+MRjqzjwNL2XlJYAJYCkQrFcmNaGpIUvmPrwPs4dLaY1ldfRRru8tG bhDkWcDknjmKCL3LVHbH1Cx/LBH1UbZa//5hIo0DBNZ2ToyyLw2egg9yUNgn5Qv2SuF0 r37tNOoaODO4L/PZ0cZE3vflojmeWyM+Q6MxKyR7Vs6XRnZ02MyK7cy53RtHo1GPmjwc 8o5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=nPxhchfI; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67750-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67750-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j25-20020a05620a001900b007869b745e1esi2539863qki.696.2024.02.15.14.13.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:13:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67750-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=nPxhchfI; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67750-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67750-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 14B241C21C26 for ; Thu, 15 Feb 2024 22:13:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD76414E2FD; Thu, 15 Feb 2024 22:08:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="nPxhchfI" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A32D146916; Thu, 15 Feb 2024 22:08:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034909; cv=none; b=JNK9L7nzEw6XLpDPXAZezhyHhU3+b9aL86vV8zr+xjBUNxP8gQL6onWPel1od3UFz5Bl/egAAyx+3CEqlyiX8a1X2yN4y5/hhbINY8HCT9pwxRmDxaj0VKfZCwC2nRbDnM179wM9GZ2aLE7mabGa6qMsT1plLAmYxz0K8NQTFY0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034909; c=relaxed/simple; bh=8Ct3J2NJkURDInEhDXz003U01AuCHf4/0dNy3zQDeEk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZTG8Qdics8WvlvDRSIdzMtTgtEXj+Jz3kgGZ31uo3jfLnd5ri6nagIyud63j7Q2FAmMEADt76T7L8sA0ebiXjimSwosIizt7AYdymphyP27EfP3H4QESsQx4rgwQ92wt1KL0nMZfDFWOSSTSzyFU1m0QsM4SO/3l8Pvu1sXcWpE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=nPxhchfI; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FM0XVx017942; Thu, 15 Feb 2024 22:08:13 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=BoYmg2I4Q0k+a3TaU4ABCYR9yHgcAHY+742VsQ7xQZc=; b=nPxhchfIkH2wViv3C6u2zH7XROEw2xoNVuvA1hfEIUgA6YNhtxmyn2aPdaWwz0y/p+6/ exuQw+XJIfY5FTTsqclVIPSsqc2LlcV83hijqHh0OWcf0OY2SQem6X3vOM0eVA4JQb6E UtFU5860C3jCIHl9MquvZcAzOj5T+Q99m69mKygTDdl74XoScKjKsJ835LBR9WJsq59U rHr9qyq54eAnQVkIlK2XTzzq0aG4uv+zaae1dn3JK8zxlQZ6N6nfZZl9l8TSSS+V8PpC g3IumJvERLjqTyWbY2OUzWUD0TbVhqjySimU1mV4V7YmOGlv9B8NS3MI27kAyn9XfN9T 5Q== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9u1bg6ak-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:12 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FJfrBX016479; Thu, 15 Feb 2024 22:08:12 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6mymyhcn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:11 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM89ED64815402 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:11 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AD99F58073; Thu, 15 Feb 2024 22:08:07 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5941C58078; Thu, 15 Feb 2024 22:08:07 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:07 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 16/33] fsi: aspeed: Remove cfam reset sysfs file in error path and remove Date: Thu, 15 Feb 2024 16:07:42 -0600 Message-Id: <20240215220759.976998-17-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: lWmY2azHfseoGHZSM51FysPjP0lIPbJt X-Proofpoint-ORIG-GUID: lWmY2azHfseoGHZSM51FysPjP0lIPbJt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=931 bulkscore=0 phishscore=0 adultscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004754352437339 X-GMAIL-MSGID: 1791004754352437339 This fixes a duplicate sysfs warning on device re-probe. Signed-off-by: Eddie James --- drivers/fsi/fsi-master-aspeed.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index 2258980e4c47..c36e7e49e965 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -410,6 +410,7 @@ static int setup_cfam_reset(struct fsi_master_aspeed *aspeed) rc = device_create_file(dev, &dev_attr_cfam_reset); if (rc) { + aspeed->cfam_reset_gpio = NULL; devm_gpiod_put(dev, gpio); return rc; } @@ -575,6 +576,9 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) err_regmap: regmap_exit(aspeed->master.map); err_release: + if (aspeed->cfam_reset_gpio) + device_remove_file(aspeed->dev, &dev_attr_cfam_reset); + clk_disable_unprepare(aspeed->clk); err_free_aspeed: kfree(aspeed); @@ -585,6 +589,9 @@ static int fsi_master_aspeed_remove(struct platform_device *pdev) { struct fsi_master_aspeed *aspeed = platform_get_drvdata(pdev); + if (aspeed->cfam_reset_gpio) + device_remove_file(aspeed->dev, &dev_attr_cfam_reset); + fsi_master_unregister(&aspeed->master); clk_disable_unprepare(aspeed->clk); From patchwork Thu Feb 15 22:07:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201802 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp156124dyb; Thu, 15 Feb 2024 14:21:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV1agEiV4Q/pgeNIUWpo6TafsKm5cIOXn7xLaUeYRgtWukz2YH05GxfkbERVbDImCZ8vHhPsnqOWzpFL2vCg8yLkZYE0w== X-Google-Smtp-Source: AGHT+IGA6NhFJE8xdETJdwCStshrGb0M36kzNGhD4fVPeNT+hqja7Q85Sg7LrF/nsEhC3KzqoQ7g X-Received: by 2002:aa7:da8e:0:b0:561:f545:24ab with SMTP id q14-20020aa7da8e000000b00561f54524abmr2303877eds.16.1708035676611; Thu, 15 Feb 2024 14:21:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035676; cv=pass; d=google.com; s=arc-20160816; b=DXcUphVRUTTRodv5YVvRFf02v5Kc51ZtJK/T2N8wwMVAhz7qftV6xLXDnGNBiEPvL3 z9a1hVashhOXzhziOoY9um+ccWnnIQy3F2/lbeqj/DeqNciJIv2A/e/NuJRqv6u8JYOI m8UM58jTZst/ZE4Usfr0jF/TtxGICjn6vBugNRWCR3Z1Mj0Yd2aJ8Qv9rQoaCg1b7H2Q vCixZWtWARwTwdXZBLsjGzjZDPX0UYxXqEYXGfWg4GCIl4q44eZwm2NVwBO8G0M/VMHI p+Cij1InU4l8bSgLxbkpp8NSQamAQfWThrCPr22x+aXRPv99lqrQAU+B20L5rDrjQIPS 9ZcA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zvpqrz1IR95x4v/nVIcA1R/mLkFs7xansTMd+3MOVyo=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=Lqj2OOJpk+SopmLCy5VTVU5Lx/WsW9bZ8n1PKoiO68gUBHD/RXUnh500PIEQHVabMe dx/zvvDbPmmo4k981inmds7JV2Mr431f9DgXsh16BqbyLnTF7T0HyiWMfCtTVr4Wo6qu JjsrCamBAJVRg8EMpxChivDr7v/Uk/YSjNXGIo5z0f34qqknnxmXCCszBw5oOXn6NFW1 l527aQGZSs1OZcRv2FUpLtpWcFay4u/08LbV/wuObYLj6NJi4nkHbmR2Hp88pm45sLm2 hE/1dy5j0uOeZ5WbFg8SHTfxiftL3tKhJGRE7l7cEtzG/ALiFBFfkf4KIjZD3lFYCkkl 4Nww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="B7P/o4j0"; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67747-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67747-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i20-20020a056402055400b00563d51ac2d1si319074edx.216.2024.02.15.14.21.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:21:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67747-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="B7P/o4j0"; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67747-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67747-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A5E071F274E9 for ; Thu, 15 Feb 2024 22:13:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 129B214F9CD; Thu, 15 Feb 2024 22:08:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="B7P/o4j0" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B8111468E1; Thu, 15 Feb 2024 22:08:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034908; cv=none; b=AJJKrgfQxqfbAHc2QH5Lk1TFy2zkBCZX+M0q1awPAI3lWHPbOi/xexmmtQrSKHFP+e9x1d7N907hdrcEemjQ29RY3v5+IYp33xmCW/Ma66OS2gkkrHMTx6P+nCfDZ3wd0anqjT+SMJG2/tLISufmKhaCwliA6VlEJa4YP8O/K0g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034908; c=relaxed/simple; bh=rehO7cLR4fQpk+ZuJ/GB/Ev81SeAWJhsriBJhdeCXCk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WCsUVyCJ6G1gTONNuy2wjNWd52jhVnenRStfRWJFgPn62ouUvXmB070FkduYz1rh8LYxofT1+DlGyacF+RZhE2lrzerLIpr0KerZ5EJskgAkmTCevRPqVitRgPl86CFnRvaQa/DkljB0wxa8nRKHS9FQNLyqZyfDBCQxd/eBiA8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=B7P/o4j0; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FM0WvO017893; Thu, 15 Feb 2024 22:08:12 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=zvpqrz1IR95x4v/nVIcA1R/mLkFs7xansTMd+3MOVyo=; b=B7P/o4j05NPCD/0yT0ifCaFZp9eC45B0JPnnpE75SHwIPLjBHkHE77qoSB0D3BtyYDud JPUaeaoXSsj7EDVD/dN/TWqsd+cmdDhYjIFql1r2WEJEfhDWnyDi19gSBT/V+qwo6LXp f/6s1TJxQml8994ISQU3wsxvmMVm3sVTXLjVVbEJ/qZSmFo0ocbXTnP6Qk0TN8yO3+cf SSJvF+ipssQd+bnvrqdcEvUJ3j/snnDRITdZchZExECbmeJpOTpy9MN/gvCOcNdFT4Bh 4SOzIYnMEkQzSLHu0PNNxjCxgHJU3amzICAzj7yRGA1Erd9zwLPnXB5codp7wgZX5Ron mQ== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9u1bg69s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:11 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FJq2tl016197; Thu, 15 Feb 2024 22:08:10 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6mymyhch-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:10 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM882h45810372 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:10 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0BD9F5806A; Thu, 15 Feb 2024 22:08:08 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B5DE158076; Thu, 15 Feb 2024 22:08:07 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:07 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 17/33] fsi: aspeed: Refactor trace functions Date: Thu, 15 Feb 2024 16:07:43 -0600 Message-Id: <20240215220759.976998-18-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: NNFDo-IrKkgOZ1em8O8Z2QNTGEKbtblX X-Proofpoint-ORIG-GUID: NNFDo-IrKkgOZ1em8O8Z2QNTGEKbtblX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=914 bulkscore=0 phishscore=0 adultscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791005217548360530 X-GMAIL-MSGID: 1791005217548360530 Remove the opb error trace, add a timeout trace, and combine the read/write traces. Signed-off-by: Eddie James --- drivers/fsi/fsi-master-aspeed.c | 29 +++------ include/trace/events/fsi_master_aspeed.h | 80 ++++++++---------------- 2 files changed, 34 insertions(+), 75 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index c36e7e49e965..1a91f3acdfcc 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -116,16 +116,17 @@ static int __opb_write(struct fsi_master_aspeed *aspeed, u32 addr, status = readl(base + OPB0_STATUS); - trace_fsi_master_aspeed_opb_write(addr, val, transfer_size, status, reg); - /* Return error when poll timed out */ - if (ret) + if (ret) { + trace_fsi_master_aspeed_timeout(reg, status, false); return ret; + } /* Command failed, master will reset */ if (status & STATUS_ERR_ACK) return -EIO; + trace_fsi_master_aspeed_opb_xfer(addr, transfer_size + 1, val, false); return 0; } @@ -169,13 +170,11 @@ static int __opb_read(struct fsi_master_aspeed *aspeed, uint32_t addr, result = readl(base + OPB0_FSI_DATA_R); - trace_fsi_master_aspeed_opb_read(addr, transfer_size, result, - readl(base + OPB0_STATUS), - reg); - /* Return error when poll timed out */ - if (ret) + if (ret) { + trace_fsi_master_aspeed_timeout(reg, status, true); return ret; + } /* Command failed, master will reset */ if (status & STATUS_ERR_ACK) @@ -198,6 +197,7 @@ static int __opb_read(struct fsi_master_aspeed *aspeed, uint32_t addr, } + trace_fsi_master_aspeed_opb_xfer(addr, transfer_size + 1, result, true); return 0; } @@ -220,19 +220,6 @@ static int check_errors(struct fsi_master_aspeed *aspeed, int err) { int ret; - if (trace_fsi_master_aspeed_opb_error_enabled()) { - __be32 mresp0, mstap0, mesrb0; - - opb_readl(aspeed, ctrl_base + FSI_MRESP0, &mresp0); - opb_readl(aspeed, ctrl_base + FSI_MSTAP0, &mstap0); - opb_readl(aspeed, ctrl_base + FSI_MESRB0, &mesrb0); - - trace_fsi_master_aspeed_opb_error( - be32_to_cpu(mresp0), - be32_to_cpu(mstap0), - be32_to_cpu(mesrb0)); - } - if (err == -EIO) { /* Check MAEB (0x70) ? */ diff --git a/include/trace/events/fsi_master_aspeed.h b/include/trace/events/fsi_master_aspeed.h index 0fff873775f1..7eeecbfec7f0 100644 --- a/include/trace/events/fsi_master_aspeed.h +++ b/include/trace/events/fsi_master_aspeed.h @@ -8,69 +8,41 @@ #include -TRACE_EVENT(fsi_master_aspeed_opb_read, - TP_PROTO(uint32_t addr, size_t size, uint32_t result, uint32_t status, uint32_t irq_status), - TP_ARGS(addr, size, result, status, irq_status), +TRACE_EVENT(fsi_master_aspeed_opb_xfer, + TP_PROTO(uint32_t addr, uint32_t size, uint32_t data, bool read), + TP_ARGS(addr, size, data, read), TP_STRUCT__entry( - __field(uint32_t, addr) - __field(size_t, size) - __field(uint32_t, result) - __field(uint32_t, status) - __field(uint32_t, irq_status) - ), + __field(uint32_t, addr) + __field(uint32_t, size) + __field(uint32_t, data) + __field(bool, read) + ), TP_fast_assign( __entry->addr = addr; __entry->size = size; - __entry->result = result; - __entry->status = status; - __entry->irq_status = irq_status; - ), - TP_printk("addr %08x size %zu: result %08x sts: %08x irq_sts: %08x", - __entry->addr, __entry->size, __entry->result, - __entry->status, __entry->irq_status - ) + __entry->data = data; + __entry->read = read; + ), + TP_printk("%s addr %08x size %u data %08x", __entry->read ? "read" : "write", + __entry->addr, __entry->size, __entry->data) ); -TRACE_EVENT(fsi_master_aspeed_opb_write, - TP_PROTO(uint32_t addr, uint32_t val, size_t size, uint32_t status, uint32_t irq_status), - TP_ARGS(addr, val, size, status, irq_status), +TRACE_EVENT(fsi_master_aspeed_timeout, + TP_PROTO(uint32_t irq, uint32_t status, bool read), + TP_ARGS(irq, status, read), TP_STRUCT__entry( - __field(uint32_t, addr) - __field(uint32_t, val) - __field(size_t, size) - __field(uint32_t, status) - __field(uint32_t, irq_status) - ), + __field(uint32_t, irq) + __field(uint32_t, status) + __field(bool, read) + ), TP_fast_assign( - __entry->addr = addr; - __entry->val = val; - __entry->size = size; + __entry->irq = irq; __entry->status = status; - __entry->irq_status = irq_status; - ), - TP_printk("addr %08x val %08x size %zu status: %08x irq_sts: %08x", - __entry->addr, __entry->val, __entry->size, - __entry->status, __entry->irq_status - ) - ); - -TRACE_EVENT(fsi_master_aspeed_opb_error, - TP_PROTO(uint32_t mresp0, uint32_t mstap0, uint32_t mesrb0), - TP_ARGS(mresp0, mstap0, mesrb0), - TP_STRUCT__entry( - __field(uint32_t, mresp0) - __field(uint32_t, mstap0) - __field(uint32_t, mesrb0) - ), - TP_fast_assign( - __entry->mresp0 = mresp0; - __entry->mstap0 = mstap0; - __entry->mesrb0 = mesrb0; - ), - TP_printk("mresp0 %08x mstap0 %08x mesrb0 %08x", - __entry->mresp0, __entry->mstap0, __entry->mesrb0 - ) - ); + __entry->read = read; + ), + TP_printk("%s irq %08x status %08x", __entry->read ? "read" : "write", __entry->irq, + __entry->status) +); TRACE_EVENT(fsi_master_aspeed_cfam_reset, TP_PROTO(bool start), From patchwork Thu Feb 15 22:07:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201781 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp152164dyb; Thu, 15 Feb 2024 14:12:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUuOSiSxJtLifug7q+kG/b0B6UasYM4YL4nlMUJoK34cbDpnAhu7aAr7Q4KDPexLLBE8T1NpSW5GNb7DhOwRosr4VdJ7g== X-Google-Smtp-Source: AGHT+IFjnhfXtHh8k/MBQPxFPFwPU7vEHdHeQVmoJCqxMp4zR9lLhnVoQ5jCffGCwNlKWI2CqoHq X-Received: by 2002:a05:6a21:2d8e:b0:1a0:7e41:cdcd with SMTP id ty14-20020a056a212d8e00b001a07e41cdcdmr2840317pzb.57.1708035148893; Thu, 15 Feb 2024 14:12:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035148; cv=pass; d=google.com; s=arc-20160816; b=aZRkWgam2UCTvk6RkFNEW4mjJV3YcaqbnuffPQdK1aRxInvuqzMnBy7RHUO/Q9VgfV YKtYdBhRCFOYIMLiAx+iOKOA0szCWnPZivzyRJu6hNgGvCzGDaF/twA1Vt0CTJliwpmb Ex87uFInV07PYijbit2ELMO4qVvqIUfnTU0o7lCd6oLCWUFIfc/Wkl96NBG9Rkaa6F0a HEvgdqGAPaRisb/ocUa80xCJ+lgENa3zN4hSL2z3y0QReLVn9VxE1Y7tO0IpB1d1cWZJ aOge5A57PaLRSUGQdbNw0LZwRblPX1Q8IJVNBOMUWjS/Du+os4suOGOyBMymgUgZ0Hhy q3fQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bofokn5J04e0ZdqBwK6c6SN9GTgFjHTcEiDFXEpuQNw=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=1IYhJslrIvoeMKcdchAv6KWQQNxxYXzJK13xJ/oy8INV28RdN8ZJuVgf3nDY4Porv9 eq3yDsxA6Met8iUgMM5q2tZE4ZOGzMdkH0PNhKMS2B3GJ6UiPzwm+kFsImLkBiKYZkrh uTBE/MNR18MWFgALO1TCUqFsWBt5QvGfygNTqV31hSBNibP5GfsntHDKYQypK7lc2l9F IokXOwrP0KSLU7Q+hc7IBql++53UIWVNNBgwMbBv9g6h13DUYnemWzxFlbhhaJSRF3QP GxTXISHa+nO7bx6OIlabVfOAh7m43N7gY46goGrwRHtud6agvPkk7kKLMlo4ZL4qCmeu 75yw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Bvc9Jgzj; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67741-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67741-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l185-20020a6325c2000000b005dc8368c55esi1716318pgl.633.2024.02.15.14.12.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:12:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67741-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Bvc9Jgzj; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67741-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67741-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id ADA9E280DE6 for ; Thu, 15 Feb 2024 22:12:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 395B214AD38; Thu, 15 Feb 2024 22:08:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Bvc9Jgzj" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80902145FE3; Thu, 15 Feb 2024 22:08:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034907; cv=none; b=qdSoRRQtt6p8votZylQJHf9ItnoIRlZMopAfdXwnHY7xfRcQ338wVCTk4LSfUeh0sJTpJIIwMSqjKjhCE9zwOH9h3XHeT6vFHKtaJZEyf3DVUV7jFtpeEpDqArTIdezig9GpttuDqXzddj+RuuQBpBJ9q2WkHGgyLtWdieAoxXY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034907; c=relaxed/simple; bh=N4MM9bu5cZzne7RyOcOdfSZDBM36xNIIHvybGlB7Shs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mmxefp3nj63wyJeIfTGsihMGcC2PmWkRj7Zw4vPUsAfcA55FF3n9Nnemep+Tk5Je9ZWy57Uhe003lt4+e5I/bvs7eUdhitP2ZCjjiuhzmxoCEYxtUkF0z8LRP6Sc8ryGLx69HOAcyvh3lFkpEX8+ce5qHGsq0Mg4IprkYN8p7TE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=Bvc9Jgzj; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLVJKw012203; Thu, 15 Feb 2024 22:08:12 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=bofokn5J04e0ZdqBwK6c6SN9GTgFjHTcEiDFXEpuQNw=; b=Bvc9JgzjfrEbiHjVe0L5qNBvZjzmotm8RgQ+0300xIrGSdybxscnoXV9GXPa+EGpw+xs kGmqWOGtVdVAjI+rIINO6dMQ/mfGzp+gMewUUPWs/VndEwO3fQUQBE/IqfKdQhx6tmyd wXEGRq8pH9kI4xgM63By4bmhnaNKxTR//PTMFXUTwwi7AIjIJIC22Gknu9RSTkBC7j5p P12whwU0b6BzsqhL6SX38eseLHv3sSvxctO/vpxoSRGQ+Da5GT8WAyduPcGA6MXmARuK Q1hbm81paJJqCu4MtNlvP2ZvleYKvZ9sGzpCrXpZKl0s4Y2BniNiLLjiB8Bn/0YXlCUk gw== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9q0v5ydc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:11 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLN4qd009920; Thu, 15 Feb 2024 22:08:10 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6p6374qp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:10 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM88NU51905198 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:10 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 546B85803F; Thu, 15 Feb 2024 22:08:08 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1432D58079; Thu, 15 Feb 2024 22:08:08 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:08 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 18/33] fsi: aspeed: Don't clear all IRQs during OPB transfers Date: Thu, 15 Feb 2024 16:07:44 -0600 Message-Id: <20240215220759.976998-19-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 5UIetqF6FNCMnR2m7GAX3Uay-smOZhuE X-Proofpoint-GUID: 5UIetqF6FNCMnR2m7GAX3Uay-smOZhuE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 clxscore=1015 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004664503697395 X-GMAIL-MSGID: 1791004664503697395 In order to support FSI interrupts, the OPB transfer functions should not clear all the IRQs pending. Instead, just write the OPB ACK bit to the IRQ status register. As commented, this register invisibly masks the interrupt once the interrupt condition is cleared. Fix this by writing 0 before each OPB transfer. Signed-off-by: Eddie James --- drivers/fsi/fsi-master-aspeed.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index 1a91f3acdfcc..64a5407a15ec 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -46,6 +46,11 @@ static const u32 fsi_base = 0xa0000000; #define OPB_CLK_SYNC 0x3c #define OPB_IRQ_CLEAR 0x40 #define OPB_IRQ_MASK 0x44 +/* + * This register does NOT behave in the expected manner. It is expected that writing 1b would clear + * the corresponding interrupt condition. However it also invisibly masks the interrupt! Writing 0b + * unmasks again. + */ #define OPB_IRQ_STATUS 0x48 #define OPB0_SELECT 0x10 @@ -64,8 +69,8 @@ static const u32 fsi_base = 0xa0000000; #define OPB1_READ_ORDER2 0x60 #define OPB_RETRY_COUNTER 0x64 -#define OPB_RETRY_COUNTER_AST2600 0x00000010 -#define OPB_RETRY_COUNTER_AST2700 0x000c0010 +#define OPB_RETRY_COUNTER_AST2600 0x00010010 +#define OPB_RETRY_COUNTER_AST2700 0x000d0010 /* OPBn_STATUS */ #define STATUS_HALFWORD_ACK BIT(0) @@ -107,13 +112,14 @@ static int __opb_write(struct fsi_master_aspeed *aspeed, u32 addr, writel_relaxed(transfer_size, base + OPB0_XFER_SIZE); writel_relaxed(addr, base + OPB0_FSI_ADDR); writel_relaxed(val, base + OPB0_FSI_DATA_W); - writel_relaxed(0x1, base + OPB_IRQ_CLEAR); + writel_relaxed(0, base + OPB_IRQ_STATUS); writel(0x1, base + OPB_TRIGGER); ret = readl_poll_timeout(base + OPB_IRQ_STATUS, reg, (reg & OPB0_XFER_ACK_EN) != 0, 0, OPB_POLL_TIMEOUT); + writel(OPB0_XFER_ACK_EN, base + OPB_IRQ_STATUS); status = readl(base + OPB0_STATUS); /* Return error when poll timed out */ @@ -159,13 +165,14 @@ static int __opb_read(struct fsi_master_aspeed *aspeed, uint32_t addr, writel_relaxed(CMD_READ, base + OPB0_RW); writel_relaxed(transfer_size, base + OPB0_XFER_SIZE); writel_relaxed(addr, base + OPB0_FSI_ADDR); - writel_relaxed(0x1, base + OPB_IRQ_CLEAR); + writel_relaxed(0, aspeed->base + OPB_IRQ_STATUS); writel(0x1, base + OPB_TRIGGER); ret = readl_poll_timeout(base + OPB_IRQ_STATUS, reg, (reg & OPB0_XFER_ACK_EN) != 0, 0, OPB_POLL_TIMEOUT); + writel(OPB0_XFER_ACK_EN, base + OPB_IRQ_STATUS); status = readl(base + OPB0_STATUS); result = readl(base + OPB0_FSI_DATA_R); @@ -489,8 +496,6 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) } writel(0x1, aspeed->base + OPB_CLK_SYNC); - writel(OPB1_XFER_ACK_EN | OPB0_XFER_ACK_EN, - aspeed->base + OPB_IRQ_MASK); writel(opb_retry_counter, aspeed->base + OPB_RETRY_COUNTER); From patchwork Thu Feb 15 22:07:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201801 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp155194dyb; Thu, 15 Feb 2024 14:19:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU56/akX/L2cqwRMtABmEqU6/RQN/8a/W63GbnXO/7P9P3/C3j76E3ztaftXnWKGzYWo4OhTEnqXUNm8UQ3wHb4DMfDYw== X-Google-Smtp-Source: AGHT+IENzJ2/Ig3wAll+10BUBM+NDb/bOIG6NBx1SgN5+2aytJUoFMijwsfblhGo5mFMwOamSeXA X-Received: by 2002:a05:6e02:f11:b0:363:d888:8f8f with SMTP id x17-20020a056e020f1100b00363d8888f8fmr2762276ilj.7.1708035547172; Thu, 15 Feb 2024 14:19:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035547; cv=pass; d=google.com; s=arc-20160816; b=GJmu7FNgixdvI+l00nmcfMDy+ctzvhQ+VBRk7nAdO+zb1bnrVlUWypgUq63/J20xqU FNX/+jhoB0HNh1f1ML4L0kfQ6GhsGyQWpT840I2UFSxFXmLiNAojtELpHN46vD8KNnjo SzDrlR3atgXkiqCUAVsRIDW7XX2yWMOAQNpPksWSsqADwny+A1QsPxFRS8nFAQC7WbxD rCDALGh8/3YcadjGSOfDLW+KEdIsySyUO4rhUuP1HaefBpdk/9CDmAWl3MEb4nuPVELn B44qEgCP6J7LqeQwjx89KRD+cSKmyAunTa58MfEx9P+HlMKnsCCggwGnlY1TPHJXTFyb 1j1g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=sgsnboEv26LhiTyNfYfFAh+jxPvF4LGnhtlgk/oYHyI=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=Qq7jvFZRE9nPqG6OpA+jSn89qZrkd2c6jPlJtrZmakktpEYLHMimGMREdfw5UZxiQ9 tuNx+qqu+7lpzTPgveauFbgJMIU4cDM8dX2MKN7JKq+Wyc4tA//0doEC0dkGmltW5Izq BRKEoXu6DoHxzRRObeEKQS+tvY7M7/YAHUk8aX3qOuEgkiy3dcP6WQraHe49bfCb9W6p 9najt4XOZ3suFGIdX/l+Ug0y8HwrakAYpTTGRBnaCmSy1kDj4wuPD2Lnw7cWiU7OFyOB BSi7vtioA/D1kkXRe++++u+McNr/+myLpOqQNPOZjQEF0E2GXGPyCYANebzGmZxJoGB9 pWvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=DS7eEBFs; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67745-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67745-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id by31-20020a056a02059f00b005dc13a2e7c1si1548531pgb.117.2024.02.15.14.19.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:19:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67745-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=DS7eEBFs; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67745-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67745-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 73145B258E0 for ; Thu, 15 Feb 2024 22:13:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BBD9014C5B9; Thu, 15 Feb 2024 22:08:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="DS7eEBFs" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85B8F1468E5; Thu, 15 Feb 2024 22:08:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034908; cv=none; b=ty5rwp5ZXbsS+AmVsM9II1veseBx5SGlhz+PfHexOylS7gTHEHwYVJPqt9dj77tSrxfw+tRLxZIaLpHqUzw+Z+cBs2Z8LglfBlBRLx3pbzqisOeln0EFiQDJ/9C4CNGlhrMstSSC/7Omb2Mky/VkjS5vrBFJeVHIRriznSjYExc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034908; c=relaxed/simple; bh=J/YFPtGFuZwFnq9P5eEqxyt+AdQR6C4+3VLiCYKWnjA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=d3Aot4yF21BFmGk1sV2J5agrjsOlnik6qcNd1XjUZk7+6rdQgZnkZBatLMUXl1cIgARh17JR0oBTlYe3n0MqDZYQt6jEggj1V5PdWqksPwzeEtjEJErU4FUCzD+3ld41gWH8UuREEh7s+ZQIAN7u5KZ6R5vmXcF2rDoy5T5DFjM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=DS7eEBFs; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FM0cQG018096; Thu, 15 Feb 2024 22:08:14 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=sgsnboEv26LhiTyNfYfFAh+jxPvF4LGnhtlgk/oYHyI=; b=DS7eEBFsS1WD9rDcLCYgPn8oSGulCVGF+NPI2Id+0v3231q5tembzTTH4eKKUB/q/ve3 eCQpONIlTdlXakHi4DVt0Ku085gzlhoedUvSIwKw+P5b75RsAl78Qrcd110oj9J/4/cb RSJX/edlXjDfrKjXffxcFcCigJtmgXoofB2jLFSVVZw6w/rHMdvorqZkeLB7CSMmWyDw MRDnS8skOrXrWoQXfTauAY+p44oLMRHFdCBR8q20UlmEdNi0qrAuUroXh9W4hTKchqRD cp0Yc/eVWxaw0faisK72/nYj4na4fPRWSswjCf436gPucyAYIzLrZ2AEukWx103atKwQ lQ== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9u1bg6b0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:13 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLB5uj010083; Thu, 15 Feb 2024 22:08:12 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6npm781k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:12 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM8AJ545810374 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:12 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B066D58081; Thu, 15 Feb 2024 22:08:08 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6683358061; Thu, 15 Feb 2024 22:08:08 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:08 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 19/33] fsi: aspeed: Only read result register for successful read Date: Thu, 15 Feb 2024 16:07:45 -0600 Message-Id: <20240215220759.976998-20-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: r6Q28LyMcXJ1VHOef_sDs1gUTO3TLGow X-Proofpoint-ORIG-GUID: r6Q28LyMcXJ1VHOef_sDs1gUTO3TLGow X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 adultscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791005082091750453 X-GMAIL-MSGID: 1791005082091750453 No reason to read the result in the error path, and remove the null pointer check on the output, as it should never be null. Signed-off-by: Eddie James --- drivers/fsi/fsi-master-aspeed.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index 64a5407a15ec..83f84ee6d6f4 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -175,8 +175,6 @@ static int __opb_read(struct fsi_master_aspeed *aspeed, uint32_t addr, writel(OPB0_XFER_ACK_EN, base + OPB_IRQ_STATUS); status = readl(base + OPB0_STATUS); - result = readl(base + OPB0_FSI_DATA_R); - /* Return error when poll timed out */ if (ret) { trace_fsi_master_aspeed_timeout(reg, status, true); @@ -187,21 +185,20 @@ static int __opb_read(struct fsi_master_aspeed *aspeed, uint32_t addr, if (status & STATUS_ERR_ACK) return -EIO; - if (out) { - switch (transfer_size) { - case XFER_BYTE: - *(u8 *)out = result; - break; - case XFER_HALFWORD: - *(u16 *)out = result; - break; - case XFER_FULLWORD: - *(u32 *)out = result; - break; - default: - return -EINVAL; - } + result = readl(base + OPB0_FSI_DATA_R); + switch (transfer_size) { + case XFER_BYTE: + *(u8 *)out = result; + break; + case XFER_HALFWORD: + *(u16 *)out = result; + break; + case XFER_FULLWORD: + *(u32 *)out = result; + break; + default: + return -EINVAL; } trace_fsi_master_aspeed_opb_xfer(addr, transfer_size + 1, result, true); From patchwork Thu Feb 15 22:07:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201787 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp152828dyb; Thu, 15 Feb 2024 14:14:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWn7J76EgtXuVWdEEWhYc/5bXUwrjMXwDC6kF0D3PbsBDKmAw7f3JOaaDKM3VOWpwbBdUmtc75ok4fGz/0oQZWofDQelg== X-Google-Smtp-Source: AGHT+IGqnUo8pwu5R1orZ0KkxSvVaMG/B3xEB5eIIzBE+/21gw9eCGZZbuiaXoAaQhXz+7ImbsRQ X-Received: by 2002:ac8:5f06:0:b0:42c:6d3f:b7e9 with SMTP id x6-20020ac85f06000000b0042c6d3fb7e9mr3316419qta.28.1708035242044; Thu, 15 Feb 2024 14:14:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035242; cv=pass; d=google.com; s=arc-20160816; b=a8YQPh4xWV3GjBb7Pqr6XpGfd72sbN4tV6k562az3iLNtZDH53ueFQYI0sZlHxq3q3 7FDJUG0g4O3/fkBzPaDln1yn/JeEOkYZnoYxe4KnbptSqgI/C9H1xExetMrRHkuQqrs7 ugL0JGmE0rGu//hU+qxVbkIMsLK8mmcZbq8qhuoRJeYQjXZs1OSiIyCg3ADrX72P/EJA Bz7I8NVmzEUGj2A5H2MEIxseJzvrUTNgULLKU0ofmuHYBXtjpXpC47DBoBQoyPNmw2S+ nPPF26raU9oAiODeLOY+4i2jrhyVcNFw8L8O+aDG/SZg70CjxcIs+cqxn9qQOng+4e/b McQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ETtwT8LcMCJW+mcR7ZD5Qq2B6I2ZwqYbef+CZ36s+uQ=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=P0NWNT51Fc84mmmqDY66lLkEcb4VxKIyEJwhS/ckAdpkLmdNvzvyJR5dWbI2wwFHOp obcNkcuNMorI//OBm/7h8c/anMrWA/xlU+wPXLoYUQPJ22RIHpauG6AE09wbwr2/c+iY uPWMavJWqX1Avw0/LI90rrmmy0LWbgQJ/2GBeCzOYo2Ph6/5eRCBA4EEuslkRuHJkUmq zEjPicK5gCiY9GlcCuugo71yxuqoal0Cr/mMqWGvs1ZcIJkrBDmdn6llCuR+PZSa0c1J +wx5KGOoX92fACOiAK87IepxHkX57h+G1AJ4St/TaAVSsIZvSY4FKGmLxihzPHtpCE52 l1xA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="P/cT8Tkn"; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67749-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67749-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t9-20020a05622a180900b0042da733e7c1si2686529qtc.711.2024.02.15.14.14.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:14:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67749-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="P/cT8Tkn"; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67749-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67749-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C25C11C21C18 for ; Thu, 15 Feb 2024 22:14:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1AF5B14F9D1; Thu, 15 Feb 2024 22:08:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="P/cT8Tkn" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30743146906; Thu, 15 Feb 2024 22:08:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034909; cv=none; b=WUUCqCupKIOqYIg95/6Iae/QiT/07NOiOjN5ehNO8FjDTLtdcUsEaMH6zcUIYzyRz55DZXGbX5VcnNhjiwCZMfCmh+QuEyN8i48vhE468hhu4lRXGMtNpa0ouoKWe/Q5e6xxhAWzxoYdGnKAs+frjp+K52uxxvaLnbM96lUeexg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034909; c=relaxed/simple; bh=vMXLZdWtNXhO12KyFpb6gqzuEGpjA+RzS5g5kNb3j6c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=k+cFT2n0uy/5TXm9d2DDtCtfR7vcnehOZ49sYqMxOApMIwT2zcgl8XFVJ/y2cZuRUoxtyj+ZUTCKPwvyyKhj9wRMeXpvn1lRVlk1gp0BexucpamoyfytAY4DwD0BigbVhkd30llP9STZvxFvAqmACrqXmrYFEpI8UJjUXlq2r54= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=P/cT8Tkn; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41FK0sSO029381; Thu, 15 Feb 2024 22:08:14 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=ETtwT8LcMCJW+mcR7ZD5Qq2B6I2ZwqYbef+CZ36s+uQ=; b=P/cT8Tkniy6tjjfK7Ahp1PYULCUzd2CmKz8ncZo/UXc2Er35U/y0F3oMwIDUpff9+kDw 85dRjVoP5kAvK0PKTUI+Flu40pNk8t2iUjC25CBDJOV8cPki1vjT3OuL/6KTUYTJqqCq wOE4JINt6VyDYDRh07YN8AOORc5kpEN9ykLcyohQaPA//q2S3iqB2kwUiWetTuGhysjJ FC3QaY9ITlA2gsb1XHGosmuzHtqEsSaDqrYmcUMLTArYyTlQU6s2xyz2M3js1EbU/ETh 0rt5zGnx4zkCy7MJzIxqPGcX2AsyO1kE63ug1GHQ7qLifdldlo7U9l4dP28K1EiZOAvk GQ== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9q0v5yec-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:13 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLHWtA009935; Thu, 15 Feb 2024 22:08:12 GMT Received: from smtprelay01.wdc07v.mail.ibm.com ([172.16.1.68]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6p6374qr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:12 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM89Ro53281072 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:11 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 107E45805A; Thu, 15 Feb 2024 22:08:09 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B8F7E58076; Thu, 15 Feb 2024 22:08:08 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:08 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 20/33] fsi: aspeed: Switch to spinlock Date: Thu, 15 Feb 2024 16:07:46 -0600 Message-Id: <20240215220759.976998-21-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: kCcQoYcjx-H77gRE48q4mt9faj7S84xb X-Proofpoint-GUID: kCcQoYcjx-H77gRE48q4mt9faj7S84xb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 clxscore=1015 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004762050197749 X-GMAIL-MSGID: 1791004762050197749 In preparation for interrupt support, switch to a spinlock rather than a mutex. Signed-off-by: Eddie James --- drivers/fsi/fsi-master-aspeed.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index 83f84ee6d6f4..1cb5bf6c05d2 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -8,11 +8,11 @@ #include #include #include -#include #include #include #include #include +#include #include #include @@ -24,7 +24,7 @@ struct fsi_master_aspeed_data { struct fsi_master_aspeed { struct fsi_master master; - struct mutex lock; /* protect HW access */ + spinlock_t lock; /* protect HW access */ struct device *dev; void __iomem *base; struct clk *clk; @@ -245,6 +245,7 @@ static int aspeed_master_read(struct fsi_master *master, int link, uint8_t id, uint32_t addr, void *val, size_t size) { struct fsi_master_aspeed *aspeed = to_fsi_master_aspeed(master); + unsigned long flags; int ret; if (id > 0x3) @@ -253,7 +254,7 @@ static int aspeed_master_read(struct fsi_master *master, int link, addr |= id << 21; addr += link * FSI_HUB_LINK_SIZE; - mutex_lock(&aspeed->lock); + spin_lock_irqsave(&aspeed->lock, flags); switch (size) { case 1: @@ -272,7 +273,7 @@ static int aspeed_master_read(struct fsi_master *master, int link, ret = check_errors(aspeed, ret); done: - mutex_unlock(&aspeed->lock); + spin_unlock_irqrestore(&aspeed->lock, flags); return ret; } @@ -280,6 +281,7 @@ static int aspeed_master_write(struct fsi_master *master, int link, uint8_t id, uint32_t addr, const void *val, size_t size) { struct fsi_master_aspeed *aspeed = to_fsi_master_aspeed(master); + unsigned long flags; int ret; if (id > 0x3) @@ -288,7 +290,7 @@ static int aspeed_master_write(struct fsi_master *master, int link, addr |= id << 21; addr += link * FSI_HUB_LINK_SIZE; - mutex_lock(&aspeed->lock); + spin_lock_irqsave(&aspeed->lock, flags); switch (size) { case 1: @@ -307,7 +309,7 @@ static int aspeed_master_write(struct fsi_master *master, int link, ret = check_errors(aspeed, ret); done: - mutex_unlock(&aspeed->lock); + spin_unlock_irqrestore(&aspeed->lock, flags); return ret; } @@ -369,15 +371,16 @@ static ssize_t cfam_reset_store(struct device *dev, struct device_attribute *att const char *buf, size_t count) { struct fsi_master_aspeed *aspeed = dev_get_drvdata(dev); + unsigned long flags; trace_fsi_master_aspeed_cfam_reset(true); - mutex_lock(&aspeed->lock); + spin_lock_irqsave(&aspeed->lock, flags); gpiod_set_value(aspeed->cfam_reset_gpio, 1); - usleep_range(900, 1000); + udelay(900); gpiod_set_value(aspeed->cfam_reset_gpio, 0); - usleep_range(900, 1000); + udelay(900); opb_writel(aspeed, ctrl_base + FSI_MRESP0, cpu_to_be32(FSI_MRESP_RST_ALL_MASTER)); - mutex_unlock(&aspeed->lock); + spin_unlock_irqrestore(&aspeed->lock, flags); trace_fsi_master_aspeed_cfam_reset(false); return count; @@ -468,6 +471,7 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) return -ENOMEM; aspeed->dev = &pdev->dev; + spin_lock_init(&aspeed->lock); aspeed->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(aspeed->base)) { @@ -543,7 +547,6 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) dev_set_drvdata(&pdev->dev, aspeed); - mutex_init(&aspeed->lock); rc = fsi_master_init(&aspeed->master, clk_get_rate(aspeed->clk)); if (rc) goto err_regmap; From patchwork Thu Feb 15 22:07:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201783 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp152417dyb; Thu, 15 Feb 2024 14:13:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVu/9i8+vHJ715ajhLTW9EvGcYtBTWFnNMm+BikQFrg87gbV2Sk4BjaUWB9BEw9vfgLKDnmtO2hv7KgNblQSE/zFWig5A== X-Google-Smtp-Source: AGHT+IFRWsJY895elAGhTT0aISA3kTaSaqVovO04H+oI4SXQSy1M2VgpUBY3iUnVeudlhBx1G+V3 X-Received: by 2002:a05:622a:453:b0:42d:de30:83e1 with SMTP id o19-20020a05622a045300b0042dde3083e1mr70323qtx.29.1708035185556; Thu, 15 Feb 2024 14:13:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035185; cv=pass; d=google.com; s=arc-20160816; b=Bvfm4Gi4TucjHz0Er0MV4CrPFXZpjSSXbslH1C1hl0C1mgOS6P+f2dKo/UmypQne9/ ZY9mMA3DpQAvarvq2EadSPeE+Ce6YhFHwToAxqssqx4AOhaML+4Vcz+EKECXD5O5k/x5 anABRgEHXf22yys9K69Eu1V2z7YN2nDKZXggGa/6Dlq7mXQkPd+QpJug7CT2JAF+RI0U ZCsB1Bth5Auq236M191VkUfI2wIHXIILk48H9eJSHGQQLcoQ0c2FWVk6T07VE16H+u4P 1na7vaZJeqz9/aW9rucJJzvafgFf3RmYWcWGK/PQiVeD+9D3i/1hObaAzF/jlSgBkgC/ WVCA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5LerAFfyndDwaim6ezZwBkxBwQM30xrAj4RWbdAGWGI=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=pmvKdg04b6du24mTth7OuKXHOXnDlRZq5lgOnxn3K+h2PP7VvIRIYEHulRmi3DouWk aGuOFOO1/V68CneRAOOLGrTHbcG+qRNpvdR7Sx4a3Op7EH0gdiRrWQ8BDbH9vEfbiZUb 613xogqL9i7aYciYBl3ySqr2+TgWCmeIBNL5KVqzJQ98gBWoT3U9t0MLJlbr2VlVisUA kJ6lSrxmuXMIXBTojmn3MEO/QSZu8pohEsNVjHKldaEy0yEt7Jpz7M4bOwMp0PK8mesD Jd25FsRVjMWrVYb/+8HR/OwlNakK/8HGxYl3xKI7BzAyKprrtUs6f3eKbI6526wl+J/Q TBkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=rvbylwj3; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67744-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67744-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j25-20020a05620a001900b007869b745e1esi2539863qki.696.2024.02.15.14.13.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:13:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67744-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=rvbylwj3; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67744-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67744-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5A7B21C2155F for ; Thu, 15 Feb 2024 22:13:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 83DE614D438; Thu, 15 Feb 2024 22:08:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="rvbylwj3" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 769FA1468E0; Thu, 15 Feb 2024 22:08:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034908; cv=none; b=W5RGhVfWKWEnePnox6y72ELRQhueBahYjP3RrEXl2K4TJhXcdtLuMlJvk3Dz8hY8/+9BWLu93rq84vMeoP/PLsSmWd38kh0OLmYu2ypISYcRJ1Ve7uPkeso01goYzPZChNu7DguKu/j1Q3gIcj8p5krgH7sTJEWmkZ519GNa51g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034908; c=relaxed/simple; bh=kx+oOcwZGizk7pnn1u+NW+Z8JFTuM9vEKXNINaOBa4U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iqzQvCVZi8OKdKzGhX9IYKWLPBBHl5BiPkcbRZ4+1YX+cLL8o6ZFeKWVMn8LYtOdmP1ZkENq0d8ssueI+fJy5LecueR40e8/vsWOzboGxSUhP7nb1svHup6uCOHYDT3aSINlfJ9BgQauUkfNQcNSn5LCM7yJsvD1p68Ef5jvrsE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=rvbylwj3; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41FKYRVt017474; Thu, 15 Feb 2024 22:08:13 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=5LerAFfyndDwaim6ezZwBkxBwQM30xrAj4RWbdAGWGI=; b=rvbylwj3uNm84Yg8IZ8AmEC9KW+ip/yxe3F8Xxk9QwOJffA0cFQ+zXkN9FbFHaCOGRaP 6qeFiEtlAMRdXWuShuzG5XFOPolm4P3zZhagWiz+rUpdfvMoETtiE+VuoLm09RleG/VD Xbz0O3sPHl2q02zFH6EkkYjLi3xWX6bm1prJoHelFjtf+NR9biYZ5o966gmGgEgfS7V0 zg/4DjcOaXNsTTbbK2hngtWsnrVMvmmH4HGFoDyJJzrOu+vz1zdnkyvbI3kAVIqal7km 6un2AOF9ZFhXCfXO8L4cIr/BeF3KYpLtQoFR457x9TYmgtPN4OKybtGKPVL/NTE/Ewqk 7w== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9q0v5yea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:13 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FJBGLp004329; Thu, 15 Feb 2024 22:08:12 GMT Received: from smtprelay01.wdc07v.mail.ibm.com ([172.16.1.68]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6kv0qtn2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:12 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM89Rw21365500 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:11 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6DE1F58060; Thu, 15 Feb 2024 22:08:09 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 190D45806E; Thu, 15 Feb 2024 22:08:09 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:09 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 21/33] fsi: aspeed: Disable relative addressing and IPOLL for cfam reset Date: Thu, 15 Feb 2024 16:07:47 -0600 Message-Id: <20240215220759.976998-22-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: DLTbBjd4rEoyNcRpFr0bLTlWQFAo-f3e X-Proofpoint-GUID: DLTbBjd4rEoyNcRpFr0bLTlWQFAo-f3e X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 suspectscore=0 phishscore=0 mlxlogscore=781 clxscore=1015 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004702499173075 X-GMAIL-MSGID: 1791004702499173075 Need to disable these for the master reset after cfam reset. Signed-off-by: Eddie James --- drivers/fsi/fsi-master-aspeed.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index 1cb5bf6c05d2..92b47bc9917a 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -375,11 +375,18 @@ static ssize_t cfam_reset_store(struct device *dev, struct device_attribute *att trace_fsi_master_aspeed_cfam_reset(true); spin_lock_irqsave(&aspeed->lock, flags); + + opb_writel(aspeed, ctrl_base + FSI_MMODE, + cpu_to_be32(aspeed->master.mmode & ~(FSI_MMODE_EIP | FSI_MMODE_RELA))); + gpiod_set_value(aspeed->cfam_reset_gpio, 1); udelay(900); gpiod_set_value(aspeed->cfam_reset_gpio, 0); udelay(900); + opb_writel(aspeed, ctrl_base + FSI_MRESP0, cpu_to_be32(FSI_MRESP_RST_ALL_MASTER)); + opb_writel(aspeed, ctrl_base + FSI_MMODE, cpu_to_be32(aspeed->master.mmode)); + spin_unlock_irqrestore(&aspeed->lock, flags); trace_fsi_master_aspeed_cfam_reset(false); From patchwork Thu Feb 15 22:07:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201788 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp153043dyb; Thu, 15 Feb 2024 14:14:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUXuIjVOP3r8h1VO1kNZcbtax4T0ekG6BXCuh04zhNUseODKDb0KKR3Is1JrL+PYON9tcAuaJPqwAOASlFmX/FhVBj6fw== X-Google-Smtp-Source: AGHT+IEfMK+dYzrLwI1toM4g/7hADFz8C6GVdVEAciglr8NmCfS5seay0gQHUBSe8VKgtIgr6C6K X-Received: by 2002:a05:6e02:ee1:b0:363:c4b9:d931 with SMTP id j1-20020a056e020ee100b00363c4b9d931mr3148261ilk.20.1708035268621; Thu, 15 Feb 2024 14:14:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035268; cv=pass; d=google.com; s=arc-20160816; b=aGaUBAdmYFvo+6mLckUHZSacVpQGceWDYQvgaP9CrsaS/frbt6kO91gW5KmMYE5A/K SPvU/V8ezOZTYRPsD5KU6MPmBs+TXk5IoFd6cHS3zrgSDgargss4Qgyk7TkOHTPuqLmG wqAwYJ5jhERo0rUl+/SIQi8NmK0Stg2/76iZ/wCzOSL93F5J9f2zqL1M7XQ4h1pwhepQ OBgFfkKJLMP7QmePiEWrH9g+kSEYAyl8LJ4gC7HUylBXPFjMTfOxHnuxkNDiesC3EmpO UaF+bFtxUWLUM0Pxvakk9IpHdvp1tI701zO99MSAkiXODEhj0TMsgtGHg9zyAi/bUISD IYqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=YFVgmE6fC8McLNPQMyrQ9AZdJJ8T1N9YLZ9PrKcr1ZY=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=Rhi49AzBzK2cyqTE7KolmvgVa7KB8GPLpWTTPRX4dsuVZpeVl700FwTuJSRXerjJrG peNaLQv5+jfPnSwpEhbknuUJ4fzgdxfZ/iTGCZXV+b3M9bmA+cvfOOCKdZDu/o9M8n7x kIfMPqVIXwGqRlfPKTNjP8nmwBsnNWMzXVAvSp29WzFq8pVxybAgFabJQxVTQj6/nqty vgU2gj/2YQRtCEiJ9zDrZrve3WvbqNG7kUrSbqFb9SlMT/MxJswaBueg4+q1ozgeL7R7 Jl9m0WbYQi35sigDgCX5vEg20/pPF5DzrUjzOte/gQpjyhy3vTjxuj3+zb9J026Lbplv Kxsg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=L4l0zTZR; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67751-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67751-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id t23-20020a639557000000b005cdf88fbc11si1702516pgn.48.2024.02.15.14.14.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:14:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67751-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=L4l0zTZR; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67751-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67751-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 66F8D2830A4 for ; Thu, 15 Feb 2024 22:14:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF2B5145336; Thu, 15 Feb 2024 22:08:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="L4l0zTZR" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 299941474C1; Thu, 15 Feb 2024 22:08:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034910; cv=none; b=GF83lywmInAtd5W5TXvLtDlZhekAaalMqyOf4zRyhhPryKdY2u46TQsQxyLTvtvK1QeowX/+ODY8JWt7Q4jPaS3/6jT3EAhyMXTZqgNX5i0lncORny6H+DDC9IocD91YDWlSwnthqkbnyhUjc0cZhH4f1uEpu8tlC47AAUBFNHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034910; c=relaxed/simple; bh=Nitj0lZrrDkxeMQ8i5VV2Bwzuo49UpxkAe+abtxsgAI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XRGKu+6gkT9vuPEBFAQ9Di+2H8Ke/qoM53K12m3AtJk+xez2/mktq8ogfd949xopR/hpncRZKYpqm0hbpbi76PROdQEmS+TOPptd71AlXLXARatv+1/xiFCqfANfBLyIf+3OGZspFg5OEY7d3etLEbxHHPyUpSSKN1Ox+0/iUYc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=L4l0zTZR; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLkHcq016092; Thu, 15 Feb 2024 22:08:15 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=YFVgmE6fC8McLNPQMyrQ9AZdJJ8T1N9YLZ9PrKcr1ZY=; b=L4l0zTZRh0Sx/5nKaY4Sje5WkSOWOX0n/IkkDz/88sMoxuPL9J+a5MGuX664FZC3Sn/k l80mWaTFJsKJLkT6opv1vtMdmcVO4IsOo73xGFHVCneB9WCu7uloNfhHTx1hjY0q0p2H tAGfvTv7axRTTtgC6DjZj/FSKW8le4MqipxnIlZjRlZRHPpg/Fqt03YtKi2sCvLckypk TV0fUUUTYoB3BHBHCq453KicWrV50Og/I/wtxvtLJFIHhztKCk35UM21+U8eRGqj4Q7n dkzPfov5bAgaX+PFKJSsPBOmVJM+b5hpSyZMSaB+L1i94el6yzndsrcFPZNGIz2LvwQk qw== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9tmf8n28-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:15 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLB5um010083; Thu, 15 Feb 2024 22:08:14 GMT Received: from smtprelay01.wdc07v.mail.ibm.com ([172.16.1.68]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6npm781v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:14 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM8BP325166376 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:13 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C14125806F; Thu, 15 Feb 2024 22:08:09 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7613858064; Thu, 15 Feb 2024 22:08:09 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:09 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 22/33] fsi: aspeed: Use common master error handler Date: Thu, 15 Feb 2024 16:07:48 -0600 Message-Id: <20240215220759.976998-23-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 8YXFbKlVAKmhtnmB7Gcf3aK36PmZktfK X-Proofpoint-ORIG-GUID: 8YXFbKlVAKmhtnmB7Gcf3aK36PmZktfK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004789809748833 X-GMAIL-MSGID: 1791004789809748833 This will do the correct mmode manipulation to do the master reset. Signed-off-by: Eddie James --- drivers/fsi/fsi-master-aspeed.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index 92b47bc9917a..ac8835e4d1f8 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -220,27 +220,6 @@ static int opb_readb(struct fsi_master_aspeed *aspeed, uint32_t addr, u8 *out) return __opb_read(aspeed, addr, XFER_BYTE, (void *)out); } -static int check_errors(struct fsi_master_aspeed *aspeed, int err) -{ - int ret; - - if (err == -EIO) { - /* Check MAEB (0x70) ? */ - - /* Then clear errors in master */ - ret = opb_writel(aspeed, ctrl_base + FSI_MRESP0, - cpu_to_be32(FSI_MRESP_RST_ALL_MASTER)); - if (ret) { - /* TODO: log? return different code? */ - return ret; - } - /* TODO: confirm that 0x70 was okay */ - } - - /* This will pass through timeout errors */ - return err; -} - static int aspeed_master_read(struct fsi_master *master, int link, uint8_t id, uint32_t addr, void *val, size_t size) { @@ -271,7 +250,8 @@ static int aspeed_master_read(struct fsi_master *master, int link, goto done; } - ret = check_errors(aspeed, ret); + if (ret == -EIO) + fsi_master_error(&aspeed->master, link); done: spin_unlock_irqrestore(&aspeed->lock, flags); return ret; @@ -307,7 +287,8 @@ static int aspeed_master_write(struct fsi_master *master, int link, goto done; } - ret = check_errors(aspeed, ret); + if (ret == -EIO) + fsi_master_error(&aspeed->master, link); done: spin_unlock_irqrestore(&aspeed->lock, flags); return ret; From patchwork Thu Feb 15 22:07:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201803 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp156147dyb; Thu, 15 Feb 2024 14:21:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWzm8Fo/aJkCPDrNW9Se4kUpKyjxh5uQ1V3KMXOX1jQx76zK2B7irgmnIYtUzDIEOjMm9BWPtS8olbWKnCxQfdwrlfmyg== X-Google-Smtp-Source: AGHT+IHm82+29hvO8D3n61zwakm/FySzkhG5q6XVRKXtZnCZxGnEhA/oXp1twuG/MOSo1Ei+cjTs X-Received: by 2002:a05:6402:38c:b0:561:f4bc:606 with SMTP id o12-20020a056402038c00b00561f4bc0606mr2804856edv.0.1708035679403; Thu, 15 Feb 2024 14:21:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035679; cv=pass; d=google.com; s=arc-20160816; b=Xi6cxHMp0NleqBLTDUeQZYcH4JjQsxmVEGPz1txlfRG0TCaSrQ0Ico6D16WoPMDl5C gLo5sHVxlKnkpxS4h77YmduK0BuefS2Z5jiG2QBz2DXD8enoMU1/uuMLTmEEZZUx7f4I ENb21vtuDcamkD2ul7P/aaq7RMJKVkSE1q8blLITlvLCQGQmgrpMiSmlwBTsGyaIPeI3 sf0KFi16C1yA8qj0lP2iavNVbBiiHySfZQS8liKXuzThK16T22HRtphbrM/0JDwsSUzq 9nQK9SE7c+YTCnVnKjNI1nXNLS++yVC0DJd42ew26EB2982wCWAitbPzhVrEP3de34ps +29Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=HykgDRpU/Z3V9YXMrGDZ6d1nwTUKVtor3vYFObRJeYk=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=Cam+n8/m4emSo3cSWk1qIGvr7m9E9N6SiQfF8bkLikjiED3agDDzfbM9QzVIw39Rms I39pZ0iYas31LenFoIAR64VvEYAdjc104tMHoNKmox4r+rSCBM1CqdLsVQo/VMq7ehVv VslWTjT551QI71uY5Pur9+SIPHX1OILWEDG14Rx2gIj1lzOxahphL49SKsrVgr1sYMk1 a8cBbA0nYTEavNCmehzi6vgE/As9hqyIvDXAvMlW4tXwesFsccv21fbjaD2DDsFQ7pG0 DWhMWn/ewWU+OSJmU4M8bAKNV/ZhB1kkso+edhMiYg41vgQ03mwXyIRI2B4HjrimELct O1sw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=GHcOVRFT; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67752-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67752-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id j24-20020aa7c418000000b00561bbb18e96si1032118edq.156.2024.02.15.14.21.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:21:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67752-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=GHcOVRFT; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67752-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67752-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AF39E1F28AA4 for ; Thu, 15 Feb 2024 22:15:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 24C04152E03; Thu, 15 Feb 2024 22:08:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="GHcOVRFT" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB3701474A3; Thu, 15 Feb 2024 22:08:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034911; cv=none; b=Gp2qiz1dYwG4wektrqZYb2F+4XUVpHXnD2wrS7johoE0AQZSfGs8cLf0AhMA6fn+7W8XN5SNpfDUejE1sWnN6ZT19nC76esRPrOxyO3CeNiX/VmNUu563m8oOSzVXAH102OiIYaBbOBW43YTBRouxCoa7ugPi1h7U+q7y1TDmyA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034911; c=relaxed/simple; bh=c3ys53Vk7psG12AS438khIO5MP9wbAq/uG1YdrklYJQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=K9ewCET2OCRMnoJR0ykBeGueAUikH3zqQL6tzZJc6oUQFvOLIoe5VlfL+1dWwIO6TnNzpgxU9onmeaIC57V9upHgIFBwn8TO6jy8kspaC7KhDavVLAvd+foWFWDMhLIz/cS9jVcDKSQ+TJ4gY6GXX3FmZW3j6+K4PCrp+jGCtVs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=GHcOVRFT; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FM6NLl026339; Thu, 15 Feb 2024 22:08:14 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=HykgDRpU/Z3V9YXMrGDZ6d1nwTUKVtor3vYFObRJeYk=; b=GHcOVRFT9wtDgHaVp2i4oS8Wi66oMGcUSMIu80d3O9Dngjfwld/e3rbfWEw6lhcAd0bf HjtKcXqqCTiP0obwMRLiGTKdIBOPMnCeyCmW90xUeIu8RJDroWVgoE7jE5Aoud2hobGj m6yKaK/2R/UIq8mu3jlLMvqqjLRvQdFpJbb2Cz86EwD6rn4fe+ZfnYnNSxAO0OFVdrnI u9KBBKTgNvAovSt0l9cIS5D/zqrDxiuA9c99/DMUg6hEeLYHEYRfGfYsJe5luKr+XTqE YgXKldAv/8Vak6r9omVAuepHsbntBla6Fs2DZM7GpZGq1+UtshJ3+YIWI8y5ZjPj/Nw0 iQ== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9u46r157-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:13 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FJlBEf016517; Thu, 15 Feb 2024 22:08:12 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6mymyhcu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:12 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM8Arj22610560 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:12 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2801E58079; Thu, 15 Feb 2024 22:08:10 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CA18558071; Thu, 15 Feb 2024 22:08:09 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:09 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 23/33] fsi: core: Add interrupt support Date: Thu, 15 Feb 2024 16:07:49 -0600 Message-Id: <20240215220759.976998-24-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: kaLSdRo_7-JcVV9z2HbZQ0Y3FvnKMpnH X-Proofpoint-GUID: kaLSdRo_7-JcVV9z2HbZQ0Y3FvnKMpnH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791005220829446920 X-GMAIL-MSGID: 1791005220829446920 Add an irq chip to the FSI master structure to control slave interrupt masking. Add a function to request an IRQ from the FSI device. The FSI master IRQ mapping is based on the FSI device engine type and slave link. Signed-off-by: Eddie James --- drivers/fsi/fsi-core.c | 196 +++++++++++++++++++++++++++++++++++++ drivers/fsi/fsi-master.h | 9 ++ include/linux/fsi.h | 2 + include/trace/events/fsi.h | 60 ++++++++++++ 4 files changed, 267 insertions(+) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 693e7c51b4af..d56ed46daf14 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -14,10 +14,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -109,6 +111,67 @@ int fsi_device_peek(struct fsi_device *dev, void *val) return fsi_slave_read(dev->slave, addr, val, sizeof(uint32_t)); } +EXPORT_SYMBOL_GPL(fsi_device_peek); + +static int fsi_request_irq(struct fsi_slave *slave, irq_handler_t handler, void *data, + unsigned int engine_irq, struct device *dev) +{ + struct device_node *parent = of_node_get(slave->master->dev.of_node); + struct irq_fwspec fwspec; + unsigned int irq; + + /* + * FSI devices can only report interrupts to their own master, so if the master + * isn't an interrupt controller, don't try and map an irq. + */ + if (!of_get_property(parent, "#interrupt-cells", NULL)) { + of_node_put(parent); + return -EINVAL; + } + + fwspec.fwnode = of_node_to_fwnode(parent); + fwspec.param_count = 1; + fwspec.param[0] = engine_irq + (slave->link * FSI_IRQ_COUNT); + irq = irq_create_fwspec_mapping(&fwspec); + if (!irq) + return -EINVAL; + + return devm_request_irq(dev, irq, handler, 0, dev_name(dev), data); +} + +int fsi_device_request_irq(struct fsi_device *dev, irq_handler_t handler, void *data) +{ + unsigned int engine_irq; + + switch (dev->engine_type) { + case 0x4: // shift + engine_irq = 1; + break; + case 0x5: // scom + engine_irq = 2; + break; + case 0x6: // scratchpad + engine_irq = 3; + break; + case 0x7: // i2cm + engine_irq = 4; + break; + case 0x20: // mbox + engine_irq = 7; + break; + case 0x22: // sbefifo + engine_irq = 6; + break; + case 0x23: // spim + engine_irq = 5; + break; + default: + return -EINVAL; + } + + return fsi_request_irq(dev->slave, handler, data, engine_irq, &dev->dev); +} +EXPORT_SYMBOL_GPL(fsi_device_request_irq); unsigned long fsi_device_local_bus_frequency(struct fsi_device *dev) { @@ -600,6 +663,9 @@ static const struct bin_attribute fsi_slave_raw_attr = { static void fsi_slave_release(struct device *dev) { struct fsi_slave *slave = to_fsi_slave(dev); + __be32 scism = cpu_to_be32(0xffffffff); + + fsi_slave_write(slave, FSI_SLAVE_BASE + FSI_SCISM, &scism, sizeof(scism)); fsi_free_minor(slave->dev.devt); of_node_put(dev->of_node); @@ -957,6 +1023,27 @@ void fsi_free_minor(dev_t dev) } EXPORT_SYMBOL_GPL(fsi_free_minor); +static irqreturn_t fsi_slave_irq(int irq, void *data) +{ + struct fsi_slave *slave = data; + __be32 reg; + u32 siss; + int rc; + + rc = fsi_slave_read(slave, FSI_SLAVE_BASE + FSI_SISS, ®, sizeof(reg)); + if (rc) + return IRQ_NONE; + + siss = be32_to_cpu(reg); + reg = cpu_to_be32(0xffffffff); + rc = fsi_slave_write(slave, FSI_SLAVE_BASE + FSI_SCISC, ®, sizeof(reg)); + if (rc) + return IRQ_NONE; + + trace_fsi_slave_irq(slave, siss); + return IRQ_HANDLED; +} + static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) { uint32_t cfam_id; @@ -1067,6 +1154,19 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) goto err_free_ida; } + rc = fsi_request_irq(slave, fsi_slave_irq, slave, 0, &slave->dev); + if (!rc) { + __be32 ssism = cpu_to_be32(FSI_SISS_ALL); + + /* clear interrupt conditions before unmasking */ + data = cpu_to_be32(0xffffffff); + fsi_master_write(master, link, id, FSI_SLAVE_BASE + FSI_SCISC, &data, + sizeof(data)); + + fsi_master_write(master, link, id, FSI_SLAVE_BASE + FSI_SSISM, &ssism, + sizeof(ssism)); + } + /* Now that we have the cdev registered with the core, any fatal * failures beyond this point will need to clean up through * cdev_device_del(). Fortunately though, nothing past here is fatal. @@ -1441,6 +1541,99 @@ void fsi_master_regmap_config(struct regmap_config *config) } EXPORT_SYMBOL_GPL(fsi_master_regmap_config); +int fsi_master_irq(struct fsi_master *master, struct irq_domain *irq_domain, unsigned int link) +{ + struct irq_desc *downstream = irq_resolve_mapping(irq_domain, (link * FSI_IRQ_COUNT) + 8); + unsigned long size = FSI_SI1S_SLAVE_BIT + 1; + unsigned long bit = FSI_SI1S_MBOX_BIT; + unsigned long srsis0 = 0; + unsigned long srsis4 = 0; + unsigned long si1s; + __be32 reg; + int rc; + + rc = fsi_master_read(master, link, 0, FSI_SLAVE_BASE + FSI_SI1S, ®, sizeof(reg)); + if (rc) + return rc; + + si1s = (unsigned long)be32_to_cpu(reg); + for_each_set_bit_from(bit, &si1s, size) + generic_handle_domain_irq(irq_domain, (link * FSI_IRQ_COUNT) + (31 - bit)); + + if (downstream) { + int i; + + master->remote_interrupt_status = 0; + + rc = fsi_master_read(master, link, 0, FSI_SLAVE_BASE + FSI_SRSIS0, ®, + sizeof(reg)); + if (rc) + return rc; + + srsis0 = (unsigned long)be32_to_cpu(reg); + for (i = 0; i < 4; ++i) { + if (srsis0 & (0xff000000 >> (8 * i))) + master->remote_interrupt_status |= (1 << i); + } + + rc = fsi_master_read(master, link, 0, FSI_SLAVE_BASE + FSI_SRSIS4, ®, + sizeof(reg)); + if (rc) + return rc; + + srsis4 = (unsigned long)be32_to_cpu(reg); + for (i = 0; i < 4; ++i) { + if (srsis4 & (0xff000000 >> (8 * i))) + master->remote_interrupt_status |= (16 << i); + } + + if (master->remote_interrupt_status) { + handle_irq_desc(downstream); + + reg = cpu_to_be32(0xffffffff); + if (master->remote_interrupt_status & 0xf) + fsi_master_write(master, link, 0, FSI_SLAVE_BASE + FSI_SRSIC0, + ®, sizeof(reg)); + + if (master->remote_interrupt_status & 0xf0) + fsi_master_write(master, link, 0, FSI_SLAVE_BASE + FSI_SRSIC4, + ®, sizeof(reg)); + } + } + + trace_fsi_master_irq(master, link, si1s, srsis0, srsis4); + return 0; +} +EXPORT_SYMBOL_GPL(fsi_master_irq); + +static void fsi_master_irq_mask(struct irq_data *data) +{ + unsigned int bit = 31 - (data->hwirq % FSI_IRQ_COUNT); + + if (bit >= FSI_SI1S_MBOX_BIT) { + struct fsi_master *master = irq_data_get_irq_chip_data(data); + int link = data->hwirq / FSI_IRQ_COUNT; + __be32 mask = cpu_to_be32(BIT(bit)); + + trace_fsi_master_irq_mask(master, link, data->hwirq % FSI_IRQ_COUNT, true); + fsi_master_write(master, link, 0, FSI_SLAVE_BASE + FSI_SCI1M, &mask, sizeof(mask)); + } +} + +static void fsi_master_irq_unmask(struct irq_data *data) +{ + unsigned int bit = 31 - (data->hwirq % FSI_IRQ_COUNT); + + if (bit >= FSI_SI1S_MBOX_BIT) { + struct fsi_master *master = irq_data_get_irq_chip_data(data); + int link = data->hwirq / FSI_IRQ_COUNT; + __be32 mask = cpu_to_be32(BIT(bit)); + + trace_fsi_master_irq_mask(master, link, data->hwirq % FSI_IRQ_COUNT, false); + fsi_master_write(master, link, 0, FSI_SLAVE_BASE + FSI_SSI1M, &mask, sizeof(mask)); + } +} + int fsi_master_register(struct fsi_master *master) { int rc; @@ -1467,6 +1660,9 @@ int fsi_master_register(struct fsi_master *master) if (!master->lbus_divider) master->lbus_divider = FSI_SMODE_LBCRR_DEFAULT; + master->irq_chip.name = dev_name(&master->dev); + master->irq_chip.irq_mask = fsi_master_irq_mask; + master->irq_chip.irq_unmask = fsi_master_irq_unmask; master->dev.class = &fsi_master_class; mutex_lock(&master->scan_lock); diff --git a/drivers/fsi/fsi-master.h b/drivers/fsi/fsi-master.h index f4cecdff3834..b718eeba3f43 100644 --- a/drivers/fsi/fsi-master.h +++ b/drivers/fsi/fsi-master.h @@ -10,6 +10,7 @@ #define DRIVERS_FSI_MASTER_H #include +#include #include /* @@ -112,6 +113,7 @@ /* Misc */ #define FSI_CRC_SIZE 4 #define FSI_LINK_ENABLE_SETUP_TIME 10 /* in mS */ +#define FSI_IRQ_COUNT 9 /* fsi-master definition and flags */ #define FSI_MASTER_FLAG_SWCLOCK 0x1 @@ -137,6 +139,7 @@ struct fsi_master { int n_links; int flags; struct mutex scan_lock; + struct irq_chip irq_chip; int (*read)(struct fsi_master *, int link, uint8_t id, uint32_t addr, void *val, size_t size); int (*write)(struct fsi_master *, int link, uint8_t id, @@ -147,6 +150,7 @@ struct fsi_master { bool enable); int (*link_config)(struct fsi_master *, int link, u8 t_send_delay, u8 t_echo_delay); + u8 remote_interrupt_status; }; #define to_fsi_master(d) container_of(d, struct fsi_master, dev) @@ -176,4 +180,9 @@ extern void fsi_master_unregister(struct fsi_master *master); extern int fsi_master_rescan(struct fsi_master *master); +struct irq_domain; + +extern int fsi_master_irq(struct fsi_master *master, struct irq_domain *irq_domain, + unsigned int link); + #endif /* DRIVERS_FSI_MASTER_H */ diff --git a/include/linux/fsi.h b/include/linux/fsi.h index e0309bf0ae07..c249a95b7ff8 100644 --- a/include/linux/fsi.h +++ b/include/linux/fsi.h @@ -8,6 +8,7 @@ #define LINUX_FSI_H #include +#include struct fsi_device { struct device dev; @@ -25,6 +26,7 @@ extern int fsi_device_write(struct fsi_device *dev, uint32_t addr, const void *val, size_t size); extern int fsi_device_peek(struct fsi_device *dev, void *val); extern unsigned long fsi_device_local_bus_frequency(struct fsi_device *dev); +extern int fsi_device_request_irq(struct fsi_device *dev, irq_handler_t handler, void *data); struct fsi_device_id { u8 engine_type; diff --git a/include/trace/events/fsi.h b/include/trace/events/fsi.h index da977d59e163..0e4d717ee0ad 100644 --- a/include/trace/events/fsi.h +++ b/include/trace/events/fsi.h @@ -8,6 +8,47 @@ #include +TRACE_EVENT(fsi_master_irq, + TP_PROTO(const struct fsi_master *master, unsigned int link, uint32_t si1s, + uint32_t srsis0, uint32_t srsis4), + TP_ARGS(master, link, si1s, srsis0, srsis4), + TP_STRUCT__entry( + __field(int, master_idx) + __field(unsigned int, link) + __field(uint32_t, si1s) + __field(uint32_t, srsis0) + __field(uint32_t, srsis4) + ), + TP_fast_assign( + __entry->master_idx = master->idx; + __entry->link = link; + __entry->si1s = si1s; + __entry->srsis0 = srsis0; + __entry->srsis4 = srsis4; + ), + TP_printk("fsi%d:%02d si1s:%08x srsis0:%08x srsis4:%08x", __entry->master_idx, + __entry->link, __entry->si1s, __entry->srsis0, __entry->srsis4) +); + +TRACE_EVENT(fsi_master_irq_mask, + TP_PROTO(const struct fsi_master *master, unsigned int link, unsigned int bit, bool mask), + TP_ARGS(master, link, bit, mask), + TP_STRUCT__entry( + __field(int, master_idx) + __field(unsigned int, link) + __field(unsigned int, bit) + __field(bool, mask) + ), + TP_fast_assign( + __entry->master_idx = master->idx; + __entry->link = link; + __entry->bit = bit; + __entry->mask = mask; + ), + TP_printk("fsi%d:%02d %s bit:%d", __entry->master_idx, __entry->link, + __entry->mask ? "mask" : "unmask", __entry->bit) +); + TRACE_EVENT(fsi_master_xfer, TP_PROTO(int master_idx, int link, int id, uint32_t addr, size_t size, const void *data, bool read), @@ -206,6 +247,25 @@ TRACE_EVENT(fsi_slave_invalid_cfam, ) ); +TRACE_EVENT(fsi_slave_irq, + TP_PROTO(const struct fsi_slave *slave, uint32_t siss), + TP_ARGS(slave, siss), + TP_STRUCT__entry( + __field(int, master_idx) + __field(int, link) + __field(int, id) + __field(uint32_t, siss) + ), + TP_fast_assign( + __entry->master_idx = slave->master->idx; + __entry->link = slave->link; + __entry->id = slave->id; + __entry->siss = siss; + ), + TP_printk("fsi%d:%02d:%02d siss:%08x", __entry->master_idx, __entry->link, __entry->id, + __entry->siss) +); + TRACE_EVENT(fsi_dev_init, TP_PROTO(const struct fsi_device *dev), TP_ARGS(dev), From patchwork Thu Feb 15 22:07:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201792 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp153741dyb; Thu, 15 Feb 2024 14:15:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUOikhIn8c/Z2iBo58p0MaFFsjlBaor6lJrvE/J5euqUMVAyQEQTMHTMlado5JmssP1sb+FDlPFyBCIlRGczXyJqpd8Nw== X-Google-Smtp-Source: AGHT+IH3KkMLB1x2qbMjdIJ8VmTGYPWicdb0MHk6o7vouVw538cinKftvaUsOPZdcBAhh+mPCdOm X-Received: by 2002:a05:6830:44d:b0:6e2:da22:1369 with SMTP id d13-20020a056830044d00b006e2da221369mr2874338otc.35.1708035350022; Thu, 15 Feb 2024 14:15:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035349; cv=pass; d=google.com; s=arc-20160816; b=M6C6IrykpjhkBp5n7aQawaqQU6G7NdepCq+ZzcQlwkt51NDn5IHRUCySrJX7D+/uoi hqlG4t2s6x4CTTKIANeLtotSWJzLhObrX4nLJFb/dr+5pQ4L0yUoTHGx9sUHSNMItglh kyhhcsFKHab8nPnPXP2F5ODDgJEOvjHV+LSZvEaao7wHagA+LaTAygUI5Fsto862GhLk N3+HGi0yLKKGKWzKZnx7e73AYFIeYoNVGnVbokwW1lMRvlHFQl4ZqX0GEQhqd+sv0hej 0nej9R3Y6dd5+10knNVCx5Qri2ulADZJS9jOgeHkp84XMkMt8dLOYBH89Iu1/G18zAvJ sTpw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=acDsFEaV89yyM3MMGJ1GuBnRej8Gzzefq6bvVEMTi8I=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=bUJFAv5hVxdga5mGHeCxoDskknnCH5izZauqd6DakG19tU6sSO1kFe+A9AQJfRwVLa MQXx9Dbf/pxocmiuSJm3yQyzEdZF+84u9vvnPo6/EriZOjwxYSn1u+++zZpLD/KUyvep zYNBCEBmP/jWqeTLSTFFgqDeJG+UiRar77f7mn6OAbSX1HxuNfZ3SXvffCr4X+nB7UsZ WL/152Crqw3nE5bcYWiVcJzIXuv+E483+ol+Ey41cxyBVWdaf8/5hTpKYEz3CtcbmX7F cY4A0Ac0iT90NJZz7bnPaLiMnDtS6mzVHjAPO5IMfbgmEh7Zg+cLDVx+dMDinSL+gr35 /c8A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="tOCCV/4C"; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67755-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67755-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id jv9-20020a05622aa08900b0042c50fceedasi2260412qtb.441.2024.02.15.14.15.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:15:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67755-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="tOCCV/4C"; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67755-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67755-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 02C101C21FBE for ; Thu, 15 Feb 2024 22:15:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28C36152E04; Thu, 15 Feb 2024 22:08:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="tOCCV/4C" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A165E1482E2; Thu, 15 Feb 2024 22:08:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034912; cv=none; b=GGfFha2jam3kXpQaHAA9akRyKFEcRnWPjSDkoZENqJekMAiX07RQ0l4TM2JOP/yhXiD/ojp1fKfErHSLq/XpuZtpuVQeYlmQS8UD3cnsjBJANP/7A+YTcVnSBtWLQyi7Q74bSnX3QaQYdgWa7T1i4wRD3NiHCm7pbxV9w19akzU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034912; c=relaxed/simple; bh=IrBE4fcRHBBIKINnpShMKbyQ6uSukeQFgVtSxmIFIdM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oc0Uy9q0XAeP0pCGdmbSoGoaeKzVqcKGVJv+VLIf61+ZDcWPpP1rtk6icTqkrVRIOJNcJLiU1xutDwjrjRMyycNnYaJ5nOoRg8fe0sdUGwcOFrgil7Ecasbiso4olc6/FCIUFARe44a52C49CjKMbSBWfqfKFRUgVfFOV+sKLCU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=tOCCV/4C; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FM6M3o026169; Thu, 15 Feb 2024 22:08:16 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=acDsFEaV89yyM3MMGJ1GuBnRej8Gzzefq6bvVEMTi8I=; b=tOCCV/4C3q3Axhvi9p20lwjr4x7gM9enAtywxxVb8oCRd/+RLS6cBw8QCRPneXoScTM3 +p3zvBvq2UM6K+mT/QG+63jCNrWKy7xWW9wR3biQcn6KQ6sqc3tSrt5M2m9tGYAiJrte jZ5rmrxOqzFtSQ5e4jaipC9YqL2NGbzv8YgAUfsDbXpP0E53SG53MsVBTVWOY4/CqwYz J5nQLkB2mCT4Yn9PlmrL2sV6g11GGQTQfHQHfC5CRhRpRvTHRCWOIRkSjA4yDWvfBil1 RoM1S9x9NoRBBpuFGw0jcQ5fCwbmdWpPZ8ppIuDJ+7X+uPIkANJigrZCIt2uT1eYG2Rz /w== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9u46r160-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:15 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FM0Eu8004287; Thu, 15 Feb 2024 22:08:15 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6kv0qtna-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:15 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM8Ce110486306 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:14 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7C2D258061; Thu, 15 Feb 2024 22:08:10 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 30C4258076; Thu, 15 Feb 2024 22:08:10 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:10 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 24/33] fsi: aspeed: Add interrupt support Date: Thu, 15 Feb 2024 16:07:50 -0600 Message-Id: <20240215220759.976998-25-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: bM638bld7yVVOlAalSevQXK-XCCphuBS X-Proofpoint-GUID: bM638bld7yVVOlAalSevQXK-XCCphuBS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 mlxlogscore=841 bulkscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004875060328819 X-GMAIL-MSGID: 1791004875060328819 Handle slave interrupts and pass them to the FSI core. Signed-off-by: Eddie James --- drivers/fsi/fsi-master-aspeed.c | 104 ++++++++++++++++++++++- include/trace/events/fsi_master_aspeed.h | 12 +++ 2 files changed, 114 insertions(+), 2 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index ac8835e4d1f8..ce16ea65f65d 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -6,6 +6,8 @@ #include #include #include +#include +#include #include #include #include @@ -25,10 +27,12 @@ struct fsi_master_aspeed_data { struct fsi_master_aspeed { struct fsi_master master; spinlock_t lock; /* protect HW access */ + struct irq_domain *irq_domain; struct device *dev; void __iomem *base; struct clk *clk; struct gpio_desc *cfam_reset_gpio; + u32 irq_mask; }; #define to_fsi_master_aspeed(m) \ @@ -80,6 +84,11 @@ static const u32 fsi_base = 0xa0000000; #define STATUS_TIMEOUT BIT(4) /* OPB_IRQ_MASK */ +#define FSI_MASTER_ERROR_IRQ BIT(28) +#define FSI_PORT_ERROR_IRQ BIT(27) +#define FSI_HOTPLUG_IRQ BIT(26) +#define FSI_REMOTE_SLV_IRQ(l) (BIT(FSI_REMOTE_SLV_IRQ_BIT) << (l)) +#define FSI_REMOTE_SLV_IRQ_BIT 18 #define OPB1_XFER_ACK_EN BIT(17) #define OPB0_XFER_ACK_EN BIT(16) @@ -316,11 +325,76 @@ static int aspeed_master_break(struct fsi_master *master, int link) return aspeed_master_write(master, link, 0, addr, &cmd, 4); } +static int aspeed_master_link_enable(struct fsi_master *master, int link, bool enable) +{ + struct fsi_master_aspeed *aspeed = to_fsi_master_aspeed(master); + unsigned long flags; + int rc; + + spin_lock_irqsave(&aspeed->lock, flags); + if (enable) { + rc = fsi_master_link_enable(master, link, enable); + if (rc) + goto done; + + aspeed->irq_mask |= FSI_REMOTE_SLV_IRQ(link); + writel(aspeed->irq_mask, aspeed->base + OPB_IRQ_MASK); + } else { + aspeed->irq_mask &= ~FSI_REMOTE_SLV_IRQ(link); + writel(aspeed->irq_mask, aspeed->base + OPB_IRQ_MASK); + + rc = fsi_master_link_enable(master, link, enable); + } + +done: + spin_unlock_irqrestore(&aspeed->lock, flags); + return rc; +} + +static irqreturn_t aspeed_master_irq(int irq, void *data) +{ + struct fsi_master_aspeed *aspeed = data; + unsigned long size = FSI_REMOTE_SLV_IRQ_BIT + aspeed->master.n_links; + unsigned long bit = FSI_REMOTE_SLV_IRQ_BIT; + unsigned long status; + + status = readl(aspeed->base + OPB_IRQ_STATUS); + writel(0, aspeed->base + OPB_IRQ_MASK); + + for_each_set_bit_from(bit, &status, size) + fsi_master_irq(&aspeed->master, aspeed->irq_domain, bit - FSI_REMOTE_SLV_IRQ_BIT); + + writel(status, aspeed->base + OPB_IRQ_STATUS); + writel(0, aspeed->base + OPB_IRQ_STATUS); + writel(aspeed->irq_mask, aspeed->base + OPB_IRQ_MASK); + + trace_fsi_master_aspeed_irq(status); + return IRQ_HANDLED; +} + +static int aspeed_master_irqd_map(struct irq_domain *domain, unsigned int irq, + irq_hw_number_t hwirq) +{ + struct fsi_master_aspeed *aspeed = domain->host_data; + + irq_set_chip_and_handler(irq, &aspeed->master.irq_chip, handle_simple_irq); + irq_set_chip_data(irq, &aspeed->master); + + return 0; +} + +static const struct irq_domain_ops aspeed_master_irq_domain_ops = { + .map = aspeed_master_irqd_map, +}; + static void aspeed_master_release(struct device *dev) { struct fsi_master_aspeed *aspeed = to_fsi_master_aspeed(to_fsi_master(dev)); + if (aspeed->irq_domain) + irq_domain_remove(aspeed->irq_domain); + regmap_exit(aspeed->master.map); kfree(aspeed); } @@ -447,6 +521,7 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) struct fsi_master_aspeed *aspeed; unsigned int reg; int rc, links; + int irq; rc = tacoma_cabled_fsi_fixup(&pdev->dev); if (rc) { @@ -527,11 +602,12 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) aspeed->master.dev.of_node = of_node_get(dev_of_node(&pdev->dev)); aspeed->master.n_links = links; - aspeed->master.flags = FSI_MASTER_FLAG_RELA; + aspeed->master.flags = FSI_MASTER_FLAG_INTERRUPT | FSI_MASTER_FLAG_RELA; aspeed->master.read = aspeed_master_read; aspeed->master.write = aspeed_master_write; aspeed->master.send_break = aspeed_master_break; aspeed->master.term = aspeed_master_term; + aspeed->master.link_enable = aspeed_master_link_enable; dev_set_drvdata(&pdev->dev, aspeed); @@ -539,9 +615,30 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) if (rc) goto err_regmap; + irq = platform_get_irq(pdev, 0); + if (irq > 0) { + unsigned int size = links * FSI_IRQ_COUNT; + + aspeed->irq_domain = irq_domain_add_linear(aspeed->dev->of_node, size, + &aspeed_master_irq_domain_ops, aspeed); + if (aspeed->irq_domain) { + rc = devm_request_irq(aspeed->dev, irq, aspeed_master_irq, 0, + dev_name(aspeed->dev), aspeed); + if (rc) { + dev_warn(aspeed->dev, "failed to request irq:%d\n", irq); + irq_domain_remove(aspeed->irq_domain); + aspeed->irq_domain = NULL; + } else { + dev_info(aspeed->dev, "enabling interrupts irq:%d\n", irq); + } + } else { + dev_warn(aspeed->dev, "failed to create irq domain\n"); + } + } + rc = fsi_master_register(&aspeed->master); if (rc) - goto err_regmap; + goto err_irq; /* At this point, fsi_master_register performs the device_initialize(), * and holds the sole reference on master.dev. This means the device @@ -553,6 +650,9 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) get_device(&aspeed->master.dev); return 0; +err_irq: + if (aspeed->irq_domain) + irq_domain_remove(aspeed->irq_domain); err_regmap: regmap_exit(aspeed->master.map); err_release: diff --git a/include/trace/events/fsi_master_aspeed.h b/include/trace/events/fsi_master_aspeed.h index 7eeecbfec7f0..dba1776334a0 100644 --- a/include/trace/events/fsi_master_aspeed.h +++ b/include/trace/events/fsi_master_aspeed.h @@ -8,6 +8,18 @@ #include +TRACE_EVENT(fsi_master_aspeed_irq, + TP_PROTO(uint32_t status), + TP_ARGS(status), + TP_STRUCT__entry( + __field(uint32_t, status) + ), + TP_fast_assign( + __entry->status = status; + ), + TP_printk("status %08x", __entry->status) +); + TRACE_EVENT(fsi_master_aspeed_opb_xfer, TP_PROTO(uint32_t addr, uint32_t size, uint32_t data, bool read), TP_ARGS(addr, size, data, read), From patchwork Thu Feb 15 22:07:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201793 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp153779dyb; Thu, 15 Feb 2024 14:15:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWYKKRUqC7Dwick0rFuNa/AsYguaQzW1hG53fZ2LvOrEA30ofAgmVQLj59jYY7vZzafI1ZfLy1B5Xra01Jk9j8POWg2uA== X-Google-Smtp-Source: AGHT+IH9Py3ItRfnKTCQQsFtfwa6dK71f8EspEbTEiK+yq8Af9OpgbbujhvPlqvLq0SuoOIia0GK X-Received: by 2002:a05:6102:548d:b0:46d:49ac:fb96 with SMTP id bk13-20020a056102548d00b0046d49acfb96mr3864179vsb.9.1708035355754; Thu, 15 Feb 2024 14:15:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035355; cv=pass; d=google.com; s=arc-20160816; b=xv9uKSPu57RW0iFxBL9hW1SdXip0TdT5sf9KYiXWzwKhmAf1XYGCgDmlSq4ZMLptSv jGXVCNpZZ6XJ3i9VCoODdEcH6wBRIRhrHakwL+q4LjGajXNqLfOUlNDvY2ROvHAKrZWX 150W5851qC8HEtV4gmCXn+w8B8TYiZ5FtPSVsUa41UQQogJLkj/NZ+NjLgENabgpPe0N NHvDRF4HkJ36FrKDIJcTGrZ0caMqW/GEvZK2Q/1it0EYoyu8S39SU+9funTwKIhWdYkh jR3BV2L799p0sNmyOeioe08yDbStmQ7S2NHYy52N8iIuqrL+2Vo7c7AwbhzzOnaSsakb Osmg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=G2U9RCikIAWX79HQyTXxI0GoS+WAxRjBt+QZS9Zg4lY=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=uoxL3tupTnO9ZFC6iUD+/WmuUlGJmFzPGDtur79Q1jGeKpcAKBWohYNqPclNUooj6T KKdRvktespLHM6B7XEF59GrKnvFbvsdftycYrgDAHVQirQvPYb/Zro0HvbdIFb7qFUBf 6MEQWVilgpl/1RL22rPWL1Fv2OheOnL9MqYpdlXr6roqq9XUpK+Td7JxfQp+c5IuUulG 5q3isDpfEVFrClLl20fwf+1M2VBp4tCSiAr4sKfp7QVi6PnC6wb54KnU+AsIHAHCJMcj zdsdIKUlcrUl6hL4rXWKJP4vqH6dfQVVx3HPwRUBOROQHK49byVoINHzqTsLAPsqkOU8 UuXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=fuz4hOv1; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67757-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67757-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 8-20020ac85648000000b0042c6ff662bcsi2282761qtt.257.2024.02.15.14.15.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:15:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67757-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=fuz4hOv1; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67757-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67757-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5AF7B1C21E37 for ; Thu, 15 Feb 2024 22:15:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7CCBD152E09; Thu, 15 Feb 2024 22:08:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="fuz4hOv1" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C70FB14A090; Thu, 15 Feb 2024 22:08:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034913; cv=none; b=C29xmP2TV76ljM8CoVc9hkiMTdExpIN0/LYxtMfdt0mKs4fRuzCvz1jIgwJN8nW9c/rFTE3zwulaT5f7OYfeZJXecK0l54v0kZJg4r+dhbN00cMTy/+awtg/aoRJGqzDiVlpsoeRkO9x058vEOSuXbNganQsjNLI7wr/R+ni9ZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034913; c=relaxed/simple; bh=QVu20tcW/pErFdegM6TNMtLP095kS72bKybdH0MbwEw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aSjOeVQWvcaeURN9z3TZzJG8Q3Mi/i4Uteq+BzvGNo7nPa2FkaXlzmaRi40KWSfau2HMimenx/sW2iC269Qi93GaPRJ6ZdatxzFyA+XvMZexmi0z3/F5svQ2srN+pvALrVrFjgdpwuqDgYeSg1oT2YlHcXrDSkH2G4bIp/T5OBg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=fuz4hOv1; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FM0csO018105; Thu, 15 Feb 2024 22:08:17 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=G2U9RCikIAWX79HQyTXxI0GoS+WAxRjBt+QZS9Zg4lY=; b=fuz4hOv1M3zbBeE9j/a2icYfCb64RzdwR31wNzdLQIMcQU7z3cPTpzegmHEYk+3mIgLi +ugcKcvDgV5vlQ9axu4EJdhi6aaqfTfKpTp7/PlT01u7eBDhGrEsnVWQdfXRthzES1Xn yxCU9uFFVb5qRNw44yck0S6ycKRDB4m3CBe2KVofm3FOzkJxIg7/qu8rL5u3IEYZxr1q l5IqhSllarI3pp2h8HyWui6u/FVW49fAqWhsWSG35qaR3u0ahjVO6h67aez8raJvVZAw OLqvqXLYl4sse52udnWfralEsWB6vNmj1GilJzL6psjoFKjXvNG6dm8kGIMMyZYHO4L8 VQ== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9u1bg6ds-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:16 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLklQN032600; Thu, 15 Feb 2024 22:08:15 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6kftyuet-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:15 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM8CsR18874962 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:15 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CE6E85807C; Thu, 15 Feb 2024 22:08:10 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 83D3D58071; Thu, 15 Feb 2024 22:08:10 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:10 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 25/33] fsi: hub: Add interrupt support Date: Thu, 15 Feb 2024 16:07:51 -0600 Message-Id: <20240215220759.976998-26-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 3dTy5CLHc1ofbCEj1Lz_O4McShRkMRj0 X-Proofpoint-ORIG-GUID: 3dTy5CLHc1ofbCEj1Lz_O4McShRkMRj0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=752 bulkscore=0 phishscore=0 adultscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004881559602978 X-GMAIL-MSGID: 1791004881559602978 The hub master receives it's interrupts from the local slave register space, which is handled in the FSI core. Therefore, just route the remote slave interrupts to the hub link device interrupts. Signed-off-by: Eddie James --- drivers/fsi/fsi-master-hub.c | 119 ++++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 3 deletions(-) diff --git a/drivers/fsi/fsi-master-hub.c b/drivers/fsi/fsi-master-hub.c index 92aa07055c56..4c3f77ae1faf 100644 --- a/drivers/fsi/fsi-master-hub.c +++ b/drivers/fsi/fsi-master-hub.c @@ -7,8 +7,10 @@ #include #include +#include #include #include +#include #include #include @@ -35,9 +37,10 @@ */ struct fsi_master_hub { struct fsi_master master; + struct irq_domain *irq_domain; struct fsi_device *upstream; - uint32_t addr, size; /* slave-relative addr of */ - /* master address space */ + uint32_t addr; + uint32_t size; }; #define to_fsi_master_hub(m) container_of(m, struct fsi_master_hub, master) @@ -77,10 +80,81 @@ static int hub_master_break(struct fsi_master *master, int link) return hub_master_write(master, link, 0, addr, &cmd, sizeof(cmd)); } +static int hub_master_link_enable(struct fsi_master *master, int link, + bool enable) +{ + struct fsi_master_hub *hub = to_fsi_master_hub(master); + u32 srsim = 0xff000000 >> (8 * (link % 4)); + int slave_idx = 4 * (link / 4); + __be32 srsim_be; + int ret; + + ret = fsi_slave_read(hub->upstream->slave, FSI_SLAVE_BASE + FSI_SRSIM0 + slave_idx, + &srsim_be, sizeof(srsim_be)); + if (ret) + return ret; + + if (enable) { + ret = fsi_master_link_enable(master, link, enable); + if (ret) + return ret; + + srsim |= be32_to_cpu(srsim_be); + srsim_be = cpu_to_be32(srsim); + ret = fsi_slave_write(hub->upstream->slave, + FSI_SLAVE_BASE + FSI_SRSIM0 + slave_idx, &srsim_be, + sizeof(srsim_be)); + } else { + srsim = be32_to_cpu(srsim_be) & ~srsim; + srsim_be = cpu_to_be32(srsim); + ret = fsi_slave_write(hub->upstream->slave, + FSI_SLAVE_BASE + FSI_SRSIM0 + slave_idx, &srsim_be, + sizeof(srsim_be)); + if (ret) + return ret; + + ret = fsi_master_link_enable(master, link, enable); + } + + return ret; +} + +static irqreturn_t hub_master_irq(int irq, void *data) +{ + struct fsi_master_hub *hub = data; + struct fsi_master *parent = hub->upstream->slave->master; + unsigned int link = 0; + + for (; link < FSI_HUB_MASTER_MAX_LINKS; ++link) { + if (parent->remote_interrupt_status & (1 << link)) + fsi_master_irq(&hub->master, hub->irq_domain, link); + } + + return IRQ_HANDLED; +} + +static int hub_master_irqd_map(struct irq_domain *domain, unsigned int irq, + irq_hw_number_t hwirq) +{ + struct fsi_master_hub *hub = domain->host_data; + + irq_set_chip_and_handler(irq, &hub->master.irq_chip, handle_simple_irq); + irq_set_chip_data(irq, &hub->master); + + return 0; +} + +static const struct irq_domain_ops hub_master_irq_domain_ops = { + .map = hub_master_irqd_map, +}; + static void hub_master_release(struct device *dev) { struct fsi_master_hub *hub = to_fsi_master_hub(to_fsi_master(dev)); + if (hub->irq_domain) + irq_domain_remove(hub->irq_domain); + regmap_exit(hub->master.map); kfree(hub); } @@ -136,6 +210,7 @@ static int hub_master_probe(struct device *dev) hub->master.read = hub_master_read; hub->master.write = hub_master_write; hub->master.send_break = hub_master_break; + hub->master.link_enable = hub_master_link_enable; dev_set_drvdata(dev, hub); @@ -143,9 +218,44 @@ static int hub_master_probe(struct device *dev) if (rc) goto err_free; + if (of_property_read_bool(dev->of_node, "interrupt-controller")) { + struct device_node *parent = of_irq_find_parent(dev->of_node); + + if (parent) { + struct irq_fwspec fwspec; + unsigned int irq; + + fwspec.fwnode = of_node_to_fwnode(parent); + fwspec.param_count = 1; + fwspec.param[0] = (fsi_dev->slave->link * FSI_IRQ_COUNT) + 8; + irq = irq_create_fwspec_mapping(&fwspec); + if (irq) { + unsigned int size = links * FSI_IRQ_COUNT; + + hub->irq_domain = irq_domain_add_linear(dev->of_node, size, + &hub_master_irq_domain_ops, + hub); + + if (hub->irq_domain) { + rc = devm_request_irq(dev, irq, hub_master_irq, 0, + dev_name(dev), hub); + if (rc) { + dev_warn(dev, "failed to request irq:%u\n", irq); + irq_domain_remove(hub->irq_domain); + hub->irq_domain = NULL; + } else { + dev_info(dev, "enabling interrupts irq:%u\n", irq); + } + } else { + dev_warn(dev, "failed to create irq domain\n"); + } + } + } + } + rc = fsi_master_register(&hub->master); if (rc) - goto err_free; + goto err_irq; /* At this point, fsi_master_register performs the device_initialize(), * and holds the sole reference on master.dev. This means the device @@ -157,6 +267,9 @@ static int hub_master_probe(struct device *dev) get_device(&hub->master.dev); return 0; +err_irq: + if (hub->irq_domain) + irq_domain_remove(hub->irq_domain); err_free: kfree(hub); err_release: From patchwork Thu Feb 15 22:07:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201785 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp152720dyb; Thu, 15 Feb 2024 14:13:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXHxZPxn9hjbwn3sYQ/iHydFQrHznHzNsVy0yubT/yOYHfUVp58x825zjLJyDKlp9bdKiJr9bGOzq3MDTYx0BMa2R8VCA== X-Google-Smtp-Source: AGHT+IGg4ztDLeGI7JDajBHi6+f4BpZ+jyhFrUVRTDnZtlFqcyjLsHoH398+0CHOc5flkyhjBkca X-Received: by 2002:aa7:870c:0:b0:6e1:15b0:f14b with SMTP id b12-20020aa7870c000000b006e115b0f14bmr3129111pfo.31.1708035227185; Thu, 15 Feb 2024 14:13:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035227; cv=pass; d=google.com; s=arc-20160816; b=wfn+1bI4RsmWAjbaKQ7PbW2ngZzhHG7K1a9nbpTtQoEt4Maz4LpqJSQ6s32/zx0OUa LhPnroWsY0LrHjLs3Iz1/jYL+0ivY9R3c8XaIfJtOQdx1lgZnb0wVKEgSjNhdpd3abad TqREPhbk6DBcYCYXRhyJVUvE7P5AotOmeoVZlioNUPaDB9pp9MC/4l6379rCcyUWi/P/ 7D08IARDmtfoMF2CjxGKy9vg+AqG+GS7HYWr1EUnT+r+QPj35vn4ggqRggF0po4I3Dj0 dkuN91WkLgkxVt3ms1uIhl4ktq2y+Zp7OZqwFZ2T+O20rjo1FBqQK5CtgDQjhUmKpf3p VA4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Dtf4pFRJxaKze/HISwspRMMKZvQZJYraVaCTtYgrlqE=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=w7NmA6zY7KjKR79RApWGNfhouykmTkLCIZkuSeBtTYLscXCVEauCv/SUPfKZUUQiMs w21wVkgsmW7dwgPL03DCnjmcmMGvqFnKNk4sHs/Z/nORjDMsgO+OfokLa6fxTZSTYBF0 KxLFqky7rnShrHDXoFyjMDiSSoS9Fc/J788uAOBkVasKYS/zU/dMUbWOl2oOVqRyuQjN Chyro5tCdNVDVIL+S+xqijbsr+Vt4mziAzPCCH0Syq0cLrB9VLi/ltYLzJ7kZryWAyMV 3+eyy+O9JCi3/YwHopzYy61tkYliLJMvIxVD6JnqXH7ilsaBZhl+4tagfBMXq0Weg4kk ORgw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=g1naOJmO; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67748-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67748-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u25-20020a656719000000b005dbdce9d103si1704080pgf.563.2024.02.15.14.13.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:13:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67748-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=g1naOJmO; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67748-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67748-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0191E282D76 for ; Thu, 15 Feb 2024 22:13:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BC5A14E2ED; Thu, 15 Feb 2024 22:08:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="g1naOJmO" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41D5014690E; Thu, 15 Feb 2024 22:08:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034909; cv=none; b=Z5+KcU7sgMzUuDi6HTSU79Wv2oAF19dPkmdJqN19TO6BI9u83k3n5Wtwzo5J9uK1Q5wX6xfUCWKgeFvDIc0tIlJKluK6px1agziLMoAug/gkQrqRJY7ihzu7gh6y03d6/aToL6T0mzegMyW7UcAZSpwwR6LS2zz++qORTr7FVXM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034909; c=relaxed/simple; bh=HehnAuv1ZYMsznUFMzhSA1GnXrpJWSxxtr7AKvAa4Qk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ux0rsXdgArnNUgKtbncRWVH11gCrclYV5/tEE4A2rYqgs+4Y0TFbhCDybkF7k16eLWF4ca8rfpKSfmYXCjM5Ppte00Sq25lIOjvbGQeVuGkQdyjY3/ACIgVuQ+w2tg2di7c+jtTlkaavlOpfILDBGuE6RcciFkos1Y3GATRMjdM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=g1naOJmO; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FM0bJf018030; Thu, 15 Feb 2024 22:08:14 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=Dtf4pFRJxaKze/HISwspRMMKZvQZJYraVaCTtYgrlqE=; b=g1naOJmOgx2Bc68XO35iF9sp12d2R0FrtyJmi6EJ1hhEnsqm9f2agDF+ReL4LcB6aBr5 urEAfEWHpV7gX9QkiQl5lt47/0AO2kcloJcIfIdaaf/E9nqvADicVxnTfSv24CbhZATD ZaowK33FUeJ1sJoiM+Sx25e/Ia4hZtvcHpErYYl+BhSttqMCBiXgRDaEpScgEWokWrwr s/2fUMp5knsxGsn1MiRjvF0o95AGWGtlfJG1PABRNUBJBbZHytXmh8qTqpPMsccoU+xo U4eEL9mLfJFA+B5vNiigPqnloWOzwlZWG658/tQ+uPyGBzGOrVv0OnDtgiCMfvuXh9MN 5Q== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9u1bg6bs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:14 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FL3HqD010050; Thu, 15 Feb 2024 22:08:13 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6npm781s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:13 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM8B1E12321532 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:13 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2D5055807E; Thu, 15 Feb 2024 22:08:11 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D70DF58063; Thu, 15 Feb 2024 22:08:10 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:10 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 26/33] ARM: dts: aspeed: FSI interrupt support Date: Thu, 15 Feb 2024 16:07:52 -0600 Message-Id: <20240215220759.976998-27-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: mZoi6w3AQ-T8E4aklnpfqBCDxZ5lp3Q8 X-Proofpoint-ORIG-GUID: mZoi6w3AQ-T8E4aklnpfqBCDxZ5lp3Q8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=445 bulkscore=0 phishscore=0 adultscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004746865138632 X-GMAIL-MSGID: 1791004746865138632 Enable FSI interrupt controllers for AST2600 and P10BMC hub master. Signed-off-by: Eddie James --- arch/arm/boot/dts/aspeed/aspeed-g6.dtsi | 4 ++++ arch/arm/boot/dts/aspeed/ibm-power10-dual.dtsi | 2 ++ 2 files changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi index c4d1faade8be..e0b44498269f 100644 --- a/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi +++ b/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi @@ -865,22 +865,26 @@ i2c: bus@1e78a000 { }; fsim0: fsi@1e79b000 { + #interrupt-cells = <1>; compatible = "aspeed,ast2600-fsi-master", "fsi-master"; reg = <0x1e79b000 0x94>; interrupts = ; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_fsi1_default>; clocks = <&syscon ASPEED_CLK_GATE_FSICLK>; + interrupt-controller; status = "disabled"; }; fsim1: fsi@1e79b100 { + #interrupt-cells = <1>; compatible = "aspeed,ast2600-fsi-master", "fsi-master"; reg = <0x1e79b100 0x94>; interrupts = ; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_fsi2_default>; clocks = <&syscon ASPEED_CLK_GATE_FSICLK>; + interrupt-controller; status = "disabled"; }; diff --git a/arch/arm/boot/dts/aspeed/ibm-power10-dual.dtsi b/arch/arm/boot/dts/aspeed/ibm-power10-dual.dtsi index a93a241d005a..44e48e39e6e9 100644 --- a/arch/arm/boot/dts/aspeed/ibm-power10-dual.dtsi +++ b/arch/arm/boot/dts/aspeed/ibm-power10-dual.dtsi @@ -166,10 +166,12 @@ occ-hwmon { }; fsi_hub0: hub@3400 { + #interrupt-cells = <1>; compatible = "fsi-master-hub"; reg = <0x3400 0x400>; #address-cells = <2>; #size-cells = <0>; + interrupt-controller; }; }; }; From patchwork Thu Feb 15 22:07:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201795 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp154008dyb; Thu, 15 Feb 2024 14:16:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW2uosWCJrh4mQG0MX10RxKadJGTJkx85QZdHbJI2WptR6ornBzmqSyJaMYU31lFwtqOiV14SjUGWf/XTl90d9zOYKR9Q== X-Google-Smtp-Source: AGHT+IGBrSUudzk8KpDEwEA+dq+23rujye0oCFdhL8DTEcqiwireUXc/dHXQyIMPKpjLZqjgupIY X-Received: by 2002:ac8:7d03:0:b0:42b:ff38:775d with SMTP id g3-20020ac87d03000000b0042bff38775dmr4275103qtb.58.1708035383808; Thu, 15 Feb 2024 14:16:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035383; cv=pass; d=google.com; s=arc-20160816; b=CtbdxWWGlyEnT4xJytCX7x3IyWCYWXYJdAtP/audtwZ3aCTcM/9LJzkmEKSmkKHuYw UF6rqJ7dMKbUhj5lq7dQccCEY4CZKzYia0oAWHvwNcRseFSj5BLgtmK6zZFWII4i4tlC FDRFK3PuRUxJsv8rqeAHNqyMe+icvbZGQv5THnNEB3TVp60CWJMVO7ZUTsl5p/KwXAJZ G7LWkBj55Ph1lcNr3SGCxXNVRz+QaU58zgdEJezAwf8og2CtaKoVSiQDD3UJJk0w9jrP efnosuDsA2cNzQkPcZmVnW95UGwQBPxmbTOeYlpXUa4Jnn7i7DrmJBZp4e8tlWXLMQEt iJWg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=0qbOHG7gDL7BluVHG6aIFuWkCkqtnciMO6tHFzvcS9c=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=SKc740l0bg11MBD8ClGqRR7ZEU3ZlRgrpyWptrEKUZYxHjChynMM/lmKUBcsLNuysn wVM2n/jwPaIzDGaOGzZdcszMCYltr8TvICniVxD+26JChPkMzZWwH8pJDVD6nQCvD5sl inTO2WZ+7ZASX3ynIYB6cZJ0BjurytY7PV2oBxcnybglrmZwaTfPnRRrD8y/BAOgHMAD cHxigmw9441io5qYsR73/iyQWQDpO7yCqi8meqxJhugltyt2PwwOuNAzM7lox13RQXWn 0nT0R27V2nHLa7LAfPokDryoMpCyTEIbapEpy+VmDQ3WIKEyTl6hh8+pFjxTeLbLIzTq BzyQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=e8MRdMO1; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67762-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67762-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 8-20020ac85648000000b0042c6ff662bcsi2282761qtt.257.2024.02.15.14.16.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:16:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67762-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=e8MRdMO1; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67762-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67762-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 86FD91C2149D for ; Thu, 15 Feb 2024 22:16:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B190D153513; Thu, 15 Feb 2024 22:08:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="e8MRdMO1" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9886214C592; Thu, 15 Feb 2024 22:08:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034916; cv=none; b=gUF76IVwjQp1Qf9jrsf/3clcGLrnQG+BDZpLwOffIJ+XRZ8XyGUPa6ZcvCC5dnf6TeOtlq7dOa2vBY+PwUAa2GgTixmvXeyiCaeDhd7gTfOuNBvrFiUhwhOrJ7QPfIkv8OABE1qKL6/bgqWdWYeRqoDTCvYTUTHo1ilaBUze+A8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034916; c=relaxed/simple; bh=T+M2Nn1CbVzGiWWZ25GQh8RxyvzQFAsyFI0vKdVAGuc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qGjt35gI4lb6QEw0zVacBhFik2zpgRxP+Y4Z1QXIWvyDthcCJiXI2/1II3VG5tKrnICr56mMayMCcE9TffO6Eoj5JN3gKw0VnGx3SdmIfBwIgKUhMTbWddTpRVJL9uiPaaVweRDrPmPLpGhd3pCin4848TRhxUVp00yAJ8FdK38= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=e8MRdMO1; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FK8lQW002054; Thu, 15 Feb 2024 22:08:15 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=0qbOHG7gDL7BluVHG6aIFuWkCkqtnciMO6tHFzvcS9c=; b=e8MRdMO1hbaviK8k/hers7rurq0QRJrMnBOOoCLA4AA64rghHbfTqBzZ5PpXXFhAQOvQ KX54O/WqsBKKnQzcVxjevUJ7XZEHh5wnGqrI3mjT1SApYpasla4jrJIFwqr/N7Opr2BL kGuM5qq340KaZkBpp6m8HvlPdb83nMx4s6tCC3eatDSh3hB3Od4M2i6fcFHOtG2rtpme RAYC6iXxAnU5oePkB7nNsAPsm8UjllfEOwn+JJoECvZDCstKiJXdlyK8brK88IFCmzFd 0OTe1HUqr3mu9o/QoWY3RLRDRiCRip1yjkM2XLa3MC6KqcP3FQL0bJ1zvMzkimZVswt2 cg== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9q8n59ad-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:14 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FJAQbL032596; Thu, 15 Feb 2024 22:08:14 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6kftyuem-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:14 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM8BZE19727026 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:13 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7FA1958070; Thu, 15 Feb 2024 22:08:11 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 35DFA5807F; Thu, 15 Feb 2024 22:08:11 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:11 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 27/33] i2c: fsi: Calculate clock divider from local bus frequency Date: Thu, 15 Feb 2024 16:07:53 -0600 Message-Id: <20240215220759.976998-28-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: h1yX6zc4QTXOHVkx21FJWZcSkuntX65z X-Proofpoint-ORIG-GUID: h1yX6zc4QTXOHVkx21FJWZcSkuntX65z X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=956 impostorscore=0 adultscore=0 suspectscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004910187607620 X-GMAIL-MSGID: 1791004910187607620 Use the new FSI device local bus clock to calculate the proper i2c clock divder and look up an optional clock-frequency property from device tree. Change the default clock divider to 7 now that the default local bus clock divider has been reduced as well. Signed-off-by: Eddie James --- drivers/i2c/busses/i2c-fsi.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c index 10332693edf0..eaecf156ac31 100644 --- a/drivers/i2c/busses/i2c-fsi.c +++ b/drivers/i2c/busses/i2c-fsi.c @@ -27,7 +27,8 @@ #define FSI_ENGID_I2C 0x7 -#define I2C_DEFAULT_CLK_DIV 6 +#define I2C_DEFAULT_CLK_DIV 7 +#define I2C_DEFAULT_CLK_RATE 400000 /* i2c registers */ #define I2C_FSI_FIFO 0x00 @@ -150,6 +151,7 @@ struct fsi_i2c_master { u8 fifo_size; struct list_head ports; struct mutex lock; + u32 clock_div; }; struct fsi_i2c_port { @@ -194,7 +196,7 @@ static int fsi_i2c_dev_init(struct fsi_i2c_master *i2c) if (rc) return rc; - mode |= FIELD_PREP(I2C_MODE_CLKDIV, I2C_DEFAULT_CLK_DIV); + mode |= FIELD_PREP(I2C_MODE_CLKDIV, i2c->clock_div); rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode); if (rc) return rc; @@ -680,6 +682,7 @@ static int fsi_i2c_probe(struct device *dev) struct fsi_i2c_port *port; struct device_node *np; u32 port_no, ports, stat; + u32 lbus; int rc; i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL); @@ -689,6 +692,20 @@ static int fsi_i2c_probe(struct device *dev) mutex_init(&i2c->lock); i2c->fsi = to_fsi_dev(dev); INIT_LIST_HEAD(&i2c->ports); + i2c->clock_div = I2C_DEFAULT_CLK_DIV; + + lbus = fsi_device_local_bus_frequency(i2c->fsi); + if (lbus) { + u32 clock = I2C_DEFAULT_CLK_RATE; + + if (!device_property_read_u32(dev, "clock-frequency", &clock)) { + if (!clock) + clock = I2C_DEFAULT_CLK_RATE; + } + + // i2c clock rate = local bus clock / (4 * (i2c clock div + 1)) + i2c->clock_div = (((lbus + (clock - 1)) / clock) / 4) - 1; + } rc = fsi_i2c_dev_init(i2c); if (rc) From patchwork Thu Feb 15 22:07:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201796 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp154072dyb; Thu, 15 Feb 2024 14:16:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXB+KfbT8bVssnuzxPhSvrOoLyjBO3B6dEMUhewblCeP0zceVEVugSx3pYyG6TQw47VyhVXnpCu+4gda9CGcHy6fUhqiw== X-Google-Smtp-Source: AGHT+IGKsmV1kdX5RrSOp711OicqOiPQSHR6VH3bal/wUSFxaZT99pPexlJEOxaOsQlsnVTv43Ah X-Received: by 2002:ac8:5acd:0:b0:42c:7ea2:42e5 with SMTP id d13-20020ac85acd000000b0042c7ea242e5mr4676032qtd.4.1708035395055; Thu, 15 Feb 2024 14:16:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035395; cv=pass; d=google.com; s=arc-20160816; b=MhLWfbufG4JxZsKlVgXfsvU+wi4AnUJJsTREFspn5qeOaRlhgR0K80jdAMRGUss7cv xPvT68JNftvJDii+JXzcxqueoKxlNwQCZcszR1J9d4rLNu3Gk6K9Eg9/YJmAn/knOWfs U5Rrtoc+hn3WhNZPh9TU+byCnpqpwz+Ru+/cCmO2mdUyl2kwr++H3e736pUXQ2GPLZkQ mkdS3hGCBCBfj2hW1pgGQnH6/HwGohP0eEjOQ/vTorjCWCFqfa2cEY5i+p5zdUH9x1/K D3YwNeFEa+8GUX/5gIOxDNWlxk7wO4tZhSQm5Y/TV4s4NwHQr0gCcJfh47E4tsFGiXmL imGw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=psAc7NhzV/4UUrvAwzBQj4m9xdKePW/86HpHbKqjtW0=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=hplQVC/1C8rUKqsmrTk+uLWdgnWtGKUrdjb5pFD/+tVmLPnFDLhI0L2ENvZ9yZWczR AEcUM6dXSg5UHA6+U8z3O8Zina8pVnbL9qUI5djdAoFVvdFpNZn7VkUMQQrNnIF8G1q0 aI+mVxSk+46gA1s0hTO06wE0Oqxc/R5IddZ3zfuA8qhOZxSde2BCcjJ+AbsmxSjcB8Eb z7xqHR81DTX77Js659pmigvMJMMgvK1OtMEPDMTl/xp9ZPTU9W4Ho8CRjtfiunQkdhjc dvQRSRfstD+Z1kE3lohC1hqoMpQInOidZIVaYlgyOHVZ0Q7oVb0FgLKp+yZYEDzlxfWQ UzVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=HE7M2XOi; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67759-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67759-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 8-20020ac85648000000b0042c6ff662bcsi2282761qtt.257.2024.02.15.14.16.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:16:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67759-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=HE7M2XOi; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67759-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67759-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C1B301C20FC7 for ; Thu, 15 Feb 2024 22:16:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1EEAA153BC1; Thu, 15 Feb 2024 22:08:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="HE7M2XOi" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D40171487FB; Thu, 15 Feb 2024 22:08:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034914; cv=none; b=Uqm30ak2h3n9kjrYOWJ4BYi0+kar7OlYohkgkkFzVbIGaGq0vIQYjiwvdNKhEwfYVxuTbRv5j64nlKBak0cTOAjlqlbsNcIp97hED2ui/GilJ72rEZWugsX8R2hS+u/9kF3OJ51je613BJftZwOaC39PW95kdWPjTPZJf0Lzgsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034914; c=relaxed/simple; bh=y7Ir3NHVxuCw/j7v8sOGwdCGBziRK95layLM4Yi7WNM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=n1QqG+YU/SmSS03+pkgPnvraQOCYidcUQTM+VxGWdwx5yxiMFf16otWqyDPdfzB00kH8RixJ+d4Q6EmIXsi/6/OMiIg34gh18I/FE3A97dzwELUsajryL6LO05EQi7uyRastGi41M0MhpNEOhVg3RoygSLAAL5YjYqYzxuaOxC0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=HE7M2XOi; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FLPhFL030019; Thu, 15 Feb 2024 22:08:16 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=psAc7NhzV/4UUrvAwzBQj4m9xdKePW/86HpHbKqjtW0=; b=HE7M2XOi6xYI4jg+HQ6cCWjai5WYAeV+qt0h+vuyaCWrJDzlWhCPCGypdZgwYGH8oqkA PsnKQt4aptQ+6WzogvgvEoQmX0kxICnOxSunou6hFMfDO3mC+kDkXZv70AOdl+96HHmw /DZY4OLJrkmyvDcPNnkEJg14LVoO2qivsTcYuaAziC8SyTL8M03QT0qqpjBU8Fw8UdTn Mx892LggVTooPXwyi0nmSlRTPHPKmJ5hROgDXJ+WOQAXnn4hu4zIJREB4BvlokkNmHx3 ez6dqHWIVrbHFEwN+xOJ9XTqcwJvyH7jXY9amrxu+V7Ilv2PNvfmhmiq8OoQxAh07K0P +g== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9s0tjy7y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:16 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLklQM032600; Thu, 15 Feb 2024 22:08:15 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6kftyueu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:15 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM8DK419399238 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:15 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DA7B458068; Thu, 15 Feb 2024 22:08:11 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8841458073; Thu, 15 Feb 2024 22:08:11 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:11 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 28/33] i2c: fsi: Improve formatting Date: Thu, 15 Feb 2024 16:07:54 -0600 Message-Id: <20240215220759.976998-29-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: XXPKvt99dsSEBLevTKf238__FqRSX-8N X-Proofpoint-ORIG-GUID: XXPKvt99dsSEBLevTKf238__FqRSX-8N X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=934 clxscore=1015 suspectscore=0 phishscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004922290627400 X-GMAIL-MSGID: 1791004922290627400 No functional change. Signed-off-by: Eddie James --- drivers/i2c/busses/i2c-fsi.c | 125 +++++++++++++++++------------------ 1 file changed, 60 insertions(+), 65 deletions(-) diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c index eaecf156ac31..bc44cad49ef2 100644 --- a/drivers/i2c/busses/i2c-fsi.c +++ b/drivers/i2c/busses/i2c-fsi.c @@ -148,10 +148,10 @@ struct fsi_i2c_master { struct fsi_device *fsi; - u8 fifo_size; struct list_head ports; struct mutex lock; u32 clock_div; + u8 fifo_size; }; struct fsi_i2c_port { @@ -165,15 +165,14 @@ struct fsi_i2c_port { static int fsi_i2c_read_reg(struct fsi_device *fsi, unsigned int reg, u32 *data) { - int rc; __be32 data_be; + int rc; rc = fsi_device_read(fsi, reg, &data_be, sizeof(data_be)); if (rc) return rc; *data = be32_to_cpu(data_be); - return 0; } @@ -187,9 +186,11 @@ static int fsi_i2c_write_reg(struct fsi_device *fsi, unsigned int reg, static int fsi_i2c_dev_init(struct fsi_i2c_master *i2c) { - int rc; - u32 mode = I2C_MODE_ENHANCED, extended_status, watermark; + u32 mode = I2C_MODE_ENHANCED; + u32 extended_status; u32 interrupt = 0; + u32 watermark; + int rc; /* since we use polling, disable interrupts */ rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_INT_MASK, &interrupt); @@ -215,9 +216,10 @@ static int fsi_i2c_dev_init(struct fsi_i2c_master *i2c) static int fsi_i2c_set_port(struct fsi_i2c_port *port) { - int rc; struct fsi_device *fsi = port->master->fsi; - u32 mode, dummy = 0; + u32 dummy = 0; + u32 mode; + int rc; rc = fsi_i2c_read_reg(fsi, I2C_FSI_MODE, &mode); if (rc) @@ -238,7 +240,6 @@ static int fsi_i2c_set_port(struct fsi_i2c_port *port) static int fsi_i2c_start(struct fsi_i2c_port *port, struct i2c_msg *msg, bool stop) { - struct fsi_i2c_master *i2c = port->master; u32 cmd = I2C_CMD_WITH_START | I2C_CMD_WITH_ADDR; port->xfrd = 0; @@ -252,7 +253,7 @@ static int fsi_i2c_start(struct fsi_i2c_port *port, struct i2c_msg *msg, cmd |= FIELD_PREP(I2C_CMD_ADDR, msg->addr); cmd |= FIELD_PREP(I2C_CMD_LEN, msg->len); - return fsi_i2c_write_reg(i2c->fsi, I2C_FSI_CMD, &cmd); + return fsi_i2c_write_reg(port->master->fsi, I2C_FSI_CMD, &cmd); } static int fsi_i2c_get_op_bytes(int op_bytes) @@ -268,18 +269,17 @@ static int fsi_i2c_get_op_bytes(int op_bytes) static int fsi_i2c_write_fifo(struct fsi_i2c_port *port, struct i2c_msg *msg, u8 fifo_count) { + int bytes_to_write = port->master->fifo_size - fifo_count; + int bytes_remaining = msg->len - port->xfrd; int write; int rc; - struct fsi_i2c_master *i2c = port->master; - int bytes_to_write = i2c->fifo_size - fifo_count; - int bytes_remaining = msg->len - port->xfrd; bytes_to_write = min(bytes_to_write, bytes_remaining); while (bytes_to_write) { write = fsi_i2c_get_op_bytes(bytes_to_write); - rc = fsi_device_write(i2c->fsi, I2C_FSI_FIFO, + rc = fsi_device_write(port->master->fsi, I2C_FSI_FIFO, &msg->buf[port->xfrd], write); if (rc) return rc; @@ -294,12 +294,11 @@ static int fsi_i2c_write_fifo(struct fsi_i2c_port *port, struct i2c_msg *msg, static int fsi_i2c_read_fifo(struct fsi_i2c_port *port, struct i2c_msg *msg, u8 fifo_count) { - int read; - int rc; - struct fsi_i2c_master *i2c = port->master; - int bytes_to_read; int xfr_remaining = msg->len - port->xfrd; + int bytes_to_read; u32 dummy; + int read; + int rc; bytes_to_read = min_t(int, fifo_count, xfr_remaining); @@ -307,7 +306,7 @@ static int fsi_i2c_read_fifo(struct fsi_i2c_port *port, struct i2c_msg *msg, read = fsi_i2c_get_op_bytes(bytes_to_read); if (xfr_remaining) { - rc = fsi_device_read(i2c->fsi, I2C_FSI_FIFO, + rc = fsi_device_read(port->master->fsi, I2C_FSI_FIFO, &msg->buf[port->xfrd], read); if (rc) return rc; @@ -316,8 +315,8 @@ static int fsi_i2c_read_fifo(struct fsi_i2c_port *port, struct i2c_msg *msg, xfr_remaining -= read; } else { /* no more buffer but data in fifo, need to clear it */ - rc = fsi_device_read(i2c->fsi, I2C_FSI_FIFO, &dummy, - read); + rc = fsi_device_read(port->master->fsi, I2C_FSI_FIFO, + &dummy, read); if (rc) return rc; } @@ -330,85 +329,80 @@ static int fsi_i2c_read_fifo(struct fsi_i2c_port *port, struct i2c_msg *msg, static int fsi_i2c_get_scl(struct i2c_adapter *adap) { - u32 stat = 0; struct fsi_i2c_port *port = adap->algo_data; - struct fsi_i2c_master *i2c = port->master; + u32 stat; - fsi_i2c_read_reg(i2c->fsi, I2C_FSI_STAT, &stat); + fsi_i2c_read_reg(port->master->fsi, I2C_FSI_STAT, &stat); return !!(stat & I2C_STAT_SCL_IN); } static void fsi_i2c_set_scl(struct i2c_adapter *adap, int val) { - u32 dummy = 0; struct fsi_i2c_port *port = adap->algo_data; - struct fsi_i2c_master *i2c = port->master; + u32 dummy = 0; if (val) - fsi_i2c_write_reg(i2c->fsi, I2C_FSI_SET_SCL, &dummy); + fsi_i2c_write_reg(port->master->fsi, I2C_FSI_SET_SCL, &dummy); else - fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_SCL, &dummy); + fsi_i2c_write_reg(port->master->fsi, I2C_FSI_RESET_SCL, &dummy); } static int fsi_i2c_get_sda(struct i2c_adapter *adap) { - u32 stat = 0; struct fsi_i2c_port *port = adap->algo_data; - struct fsi_i2c_master *i2c = port->master; + u32 stat; - fsi_i2c_read_reg(i2c->fsi, I2C_FSI_STAT, &stat); + fsi_i2c_read_reg(port->master->fsi, I2C_FSI_STAT, &stat); return !!(stat & I2C_STAT_SDA_IN); } static void fsi_i2c_set_sda(struct i2c_adapter *adap, int val) { - u32 dummy = 0; struct fsi_i2c_port *port = adap->algo_data; - struct fsi_i2c_master *i2c = port->master; + u32 dummy = 0; if (val) - fsi_i2c_write_reg(i2c->fsi, I2C_FSI_SET_SDA, &dummy); + fsi_i2c_write_reg(port->master->fsi, I2C_FSI_SET_SDA, &dummy); else - fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_SDA, &dummy); + fsi_i2c_write_reg(port->master->fsi, I2C_FSI_RESET_SDA, &dummy); } static void fsi_i2c_prepare_recovery(struct i2c_adapter *adap) { - int rc; - u32 mode; struct fsi_i2c_port *port = adap->algo_data; - struct fsi_i2c_master *i2c = port->master; + u32 mode; + int rc; - rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_MODE, &mode); + rc = fsi_i2c_read_reg(port->master->fsi, I2C_FSI_MODE, &mode); if (rc) return; mode |= I2C_MODE_DIAG; - fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode); + fsi_i2c_write_reg(port->master->fsi, I2C_FSI_MODE, &mode); } static void fsi_i2c_unprepare_recovery(struct i2c_adapter *adap) { - int rc; - u32 mode; struct fsi_i2c_port *port = adap->algo_data; - struct fsi_i2c_master *i2c = port->master; + u32 mode; + int rc; - rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_MODE, &mode); + rc = fsi_i2c_read_reg(port->master->fsi, I2C_FSI_MODE, &mode); if (rc) return; mode &= ~I2C_MODE_DIAG; - fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode); + fsi_i2c_write_reg(port->master->fsi, I2C_FSI_MODE, &mode); } static int fsi_i2c_reset_bus(struct fsi_i2c_master *i2c, struct fsi_i2c_port *port) { + u32 dummy = 0; + u32 stat; int rc; - u32 stat, dummy = 0; /* force bus reset, ignore errors */ i2c_recover_bus(&port->adapter); @@ -439,8 +433,9 @@ static int fsi_i2c_reset_bus(struct fsi_i2c_master *i2c, static int fsi_i2c_reset_engine(struct fsi_i2c_master *i2c, u16 port) { + u32 dummy = 0; + u32 mode; int rc; - u32 mode, dummy = 0; /* reset engine */ rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_I2C, &dummy); @@ -476,18 +471,17 @@ static int fsi_i2c_reset_engine(struct fsi_i2c_master *i2c, u16 port) static int fsi_i2c_abort(struct fsi_i2c_port *port, u32 status) { - int rc; - unsigned long start; + struct fsi_i2c_master *i2c = port->master; u32 cmd = I2C_CMD_WITH_STOP; + unsigned long start; u32 stat; - struct fsi_i2c_master *i2c = port->master; - struct fsi_device *fsi = i2c->fsi; + int rc; rc = fsi_i2c_reset_engine(i2c, port->port); if (rc) return rc; - rc = fsi_i2c_read_reg(fsi, I2C_FSI_STAT, &stat); + rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_STAT, &stat); if (rc) return rc; @@ -503,15 +497,14 @@ static int fsi_i2c_abort(struct fsi_i2c_port *port, u32 status) return 0; /* write stop command */ - rc = fsi_i2c_write_reg(fsi, I2C_FSI_CMD, &cmd); + rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_CMD, &cmd); if (rc) return rc; /* wait until we see command complete in the master */ start = jiffies; - do { - rc = fsi_i2c_read_reg(fsi, I2C_FSI_STAT, &status); + rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_STAT, &status); if (rc) return rc; @@ -527,8 +520,8 @@ static int fsi_i2c_abort(struct fsi_i2c_port *port, u32 status) static int fsi_i2c_handle_status(struct fsi_i2c_port *port, struct i2c_msg *msg, u32 status) { - int rc; u8 fifo_count; + int rc; if (status & I2C_STAT_ERR) { rc = fsi_i2c_abort(port, status); @@ -576,9 +569,9 @@ static int fsi_i2c_handle_status(struct fsi_i2c_port *port, static int fsi_i2c_wait(struct fsi_i2c_port *port, struct i2c_msg *msg, unsigned long timeout) { - u32 status = 0; - int rc; unsigned long start = jiffies; + u32 status; + int rc; do { rc = fsi_i2c_read_reg(port->master->fsi, I2C_FSI_STAT, @@ -608,13 +601,13 @@ static int fsi_i2c_wait(struct fsi_i2c_port *port, struct i2c_msg *msg, static int fsi_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) { - int i, rc; - unsigned long start_time; struct fsi_i2c_port *port = adap->algo_data; - struct fsi_i2c_master *master = port->master; + unsigned long start_time; struct i2c_msg *msg; + int rc; + int i; - mutex_lock(&master->lock); + mutex_lock(&port->master->lock); rc = fsi_i2c_set_port(port); if (rc) @@ -635,7 +628,7 @@ static int fsi_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, } unlock: - mutex_unlock(&master->lock); + mutex_unlock(&port->master->lock); return rc ? : num; } @@ -681,8 +674,10 @@ static int fsi_i2c_probe(struct device *dev) struct fsi_i2c_master *i2c; struct fsi_i2c_port *port; struct device_node *np; - u32 port_no, ports, stat; + u32 port_no; + u32 ports; u32 lbus; + u32 stat; int rc; i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL); @@ -753,14 +748,14 @@ static int fsi_i2c_probe(struct device *dev) } dev_set_drvdata(dev, i2c); - return 0; } static int fsi_i2c_remove(struct device *dev) { struct fsi_i2c_master *i2c = dev_get_drvdata(dev); - struct fsi_i2c_port *port, *tmp; + struct fsi_i2c_port *port; + struct fsi_i2c_port *tmp; list_for_each_entry_safe(port, tmp, &i2c->ports, list) { list_del(&port->list); From patchwork Thu Feb 15 22:07:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201794 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp153910dyb; Thu, 15 Feb 2024 14:16:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVYe7L/UkKh8fZu8yt17oNjYcFEw4Teytf19S/RzfTi+Izpeu1NyuaRVKYMGglfchah4ULnCCzEMmBU9RCBmoZfBDbBnw== X-Google-Smtp-Source: AGHT+IF+awcbq61RkV6/cfUDYurefmCcx9NKJeF57z0YlULOzxk51ZU6atA+cBrkE7n46tJmhS07 X-Received: by 2002:a05:6a00:4fd1:b0:6e0:f6ed:cf19 with SMTP id le17-20020a056a004fd100b006e0f6edcf19mr3655824pfb.18.1708035368955; Thu, 15 Feb 2024 14:16:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035368; cv=pass; d=google.com; s=arc-20160816; b=knmrPWMbErkJWtUSbUtxfhlIQVg55QpgZAiZ0XrAnzucF6EhgnB7TdppDI2CNd6inf mBHAZpu7RLyY5cQDAS5UaALl32YYk+boPiqNyJWh6/lZolO/eV20tSHdu8EuAZHDQNU1 sKCJLWvGArbNAzEIgskFZKmj2xc3dWGXwBUd/dPX23R9C4sHb8gxxroeqcKWPJaEUHfF LgK4NLL6ESQmSqkxHkf+z1I8f6KfXRtEBVKX5B0MolQ6Yo7Hl51DE0j4LnZ4NuUYRUMk 3Ex/kJUd2xmCSKPVydaK6nj6vWHNh6JqaBlMgGmD8IOzka2gYR6x3Pb2sj+1Sp3B7Zlh dpEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=WfBD8Asm+mV0Bam4k6IBKyEciz8onft06t3pHx4oKg8=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=vtIyHW2l6vjvJmvGgTTZMYjAIJvDcsIK0Hee3liXN6vfYKl6aLxAf9KgU+ynV9csGl zEyhVSE4wC+jhPEK/djYrArrMuMUkYYk6VB28cv3PEf8XgyOnn8VU7eoKb2rPRBCn69s YiLBngXuK4onPyFAGPkbNfIKLdCM4IZVYIeDLW6DQwKMXHsSVei3Cf+ZTfmkEQTzWtXM NsatWYkDaph1edpAV3y49KJmdZoRznB0SNNoLFTowbvsHCv9m51M/V1GG8aXKzLyBcWR wzHHh3c7pHCaZ8oW6ERG+ociGxmvBLpfUKvLqCL6Y0zqwwzyCgAPVZW7RAHVo3sRuiTP wPmA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=GBYXcLlH; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67758-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67758-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p28-20020a63951c000000b005ced65a49e8si1806468pgd.734.2024.02.15.14.16.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:16:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67758-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=GBYXcLlH; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67758-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67758-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BACA2282294 for ; Thu, 15 Feb 2024 22:16:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 140431534F6; Thu, 15 Feb 2024 22:08:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="GBYXcLlH" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60B8B14900D; Thu, 15 Feb 2024 22:08:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034914; cv=none; b=ZwuTCeGPeeSC+w7C7d27OU1MqRA1ei5VqTjV6aQVdNXrasyRBFkQzSfUhyiaHv7KnstTgZWIC2x5mLJ/sUaPllkNFbkcqbq0QLn7e0agIlOMPASCO658jMdQrm32PATWoEqDvcSQghsuYrOpXRkvVJ01VM/JsStz0F5EY7TcUwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034914; c=relaxed/simple; bh=dy7BHjNi3sCnkRYeOejehYWb5ftkNMI+oDiVGphW4jc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ilDHqA9izr4WrBA1YE2BRg9NNChZuldeukyJ0dCYUZF1yyybktAcNXGmoJZ/fjbCwfCL2p0qKkEpHI8mqOeWeXl9tEmxBh/q2D0yUY/QtCpsjwKWe6KGOZ2k3HQ5gmoM7xkahIUWz/uhYkhqgEl0zo2ggYCXAj4RAlKMv5tlt+8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=GBYXcLlH; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FM0XuT017921; Thu, 15 Feb 2024 22:08:17 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=WfBD8Asm+mV0Bam4k6IBKyEciz8onft06t3pHx4oKg8=; b=GBYXcLlH++7izMTzCUxzHnG5EXcHfMRsT7hPJWI3ZgP90JRjUTz1Lb7ZwmULYkKJK4Dq 9oCVfsGnOsw8FFhgr5rBQeXoOs/5jiX5Y7H6VlPxzh8lYywc04p4mnOMRaNrzNtpsej0 vDLzxjY8VnpzlDeAZLdbo9ClM9MQ+tCvzfWeycxEhVquZfyDtiF2Z+TZwDltyNgMK3N8 jZlyDcl8/GKLNlaUh2zw1vqoztgiGKhsBCVqvVjGD9my4HPN4N0jjmbpGcdSQypRlC+r Ik4pu9tAr1vypNAN7U6/R7P2SGp27jRkXB+6VYtEogrnxYl9ESs8qs4O16WjqErKKgTX sg== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9u1bg6cm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:16 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLD0R2009728; Thu, 15 Feb 2024 22:08:14 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6p6374r3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:14 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM8CmY5898898 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:14 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 388785806C; Thu, 15 Feb 2024 22:08:12 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E304858078; Thu, 15 Feb 2024 22:08:11 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:11 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 29/33] i2c: fsi: Change fsi_i2c_write_reg to accept data instead of a pointer Date: Thu, 15 Feb 2024 16:07:55 -0600 Message-Id: <20240215220759.976998-30-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ZftRL5j_SYl94jZTISGKJGeSUEBf9mwN X-Proofpoint-ORIG-GUID: ZftRL5j_SYl94jZTISGKJGeSUEBf9mwN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 adultscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004894518385102 X-GMAIL-MSGID: 1791004894518385102 There's no use passing a pointer here. Signed-off-by: Eddie James --- drivers/i2c/busses/i2c-fsi.c | 47 +++++++++++++++--------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c index bc44cad49ef2..f237e76d29e6 100644 --- a/drivers/i2c/busses/i2c-fsi.c +++ b/drivers/i2c/busses/i2c-fsi.c @@ -177,9 +177,9 @@ static int fsi_i2c_read_reg(struct fsi_device *fsi, unsigned int reg, } static int fsi_i2c_write_reg(struct fsi_device *fsi, unsigned int reg, - u32 *data) + u32 data) { - __be32 data_be = cpu_to_be32p(data); + __be32 data_be = cpu_to_be32(data); return fsi_device_write(fsi, reg, &data_be, sizeof(data_be)); } @@ -188,17 +188,16 @@ static int fsi_i2c_dev_init(struct fsi_i2c_master *i2c) { u32 mode = I2C_MODE_ENHANCED; u32 extended_status; - u32 interrupt = 0; u32 watermark; int rc; /* since we use polling, disable interrupts */ - rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_INT_MASK, &interrupt); + rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_INT_MASK, 0); if (rc) return rc; mode |= FIELD_PREP(I2C_MODE_CLKDIV, i2c->clock_div); - rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode); + rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, mode); if (rc) return rc; @@ -211,13 +210,12 @@ static int fsi_i2c_dev_init(struct fsi_i2c_master *i2c) i2c->fifo_size - I2C_FIFO_HI_LVL); watermark |= FIELD_PREP(I2C_WATERMARK_LO, I2C_FIFO_LO_LVL); - return fsi_i2c_write_reg(i2c->fsi, I2C_FSI_WATER_MARK, &watermark); + return fsi_i2c_write_reg(i2c->fsi, I2C_FSI_WATER_MARK, watermark); } static int fsi_i2c_set_port(struct fsi_i2c_port *port) { struct fsi_device *fsi = port->master->fsi; - u32 dummy = 0; u32 mode; int rc; @@ -229,12 +227,12 @@ static int fsi_i2c_set_port(struct fsi_i2c_port *port) return 0; mode = (mode & ~I2C_MODE_PORT) | FIELD_PREP(I2C_MODE_PORT, port->port); - rc = fsi_i2c_write_reg(fsi, I2C_FSI_MODE, &mode); + rc = fsi_i2c_write_reg(fsi, I2C_FSI_MODE, mode); if (rc) return rc; /* reset engine when port is changed */ - return fsi_i2c_write_reg(fsi, I2C_FSI_RESET_ERR, &dummy); + return fsi_i2c_write_reg(fsi, I2C_FSI_RESET_ERR, 0); } static int fsi_i2c_start(struct fsi_i2c_port *port, struct i2c_msg *msg, @@ -253,7 +251,7 @@ static int fsi_i2c_start(struct fsi_i2c_port *port, struct i2c_msg *msg, cmd |= FIELD_PREP(I2C_CMD_ADDR, msg->addr); cmd |= FIELD_PREP(I2C_CMD_LEN, msg->len); - return fsi_i2c_write_reg(port->master->fsi, I2C_FSI_CMD, &cmd); + return fsi_i2c_write_reg(port->master->fsi, I2C_FSI_CMD, cmd); } static int fsi_i2c_get_op_bytes(int op_bytes) @@ -340,12 +338,11 @@ static int fsi_i2c_get_scl(struct i2c_adapter *adap) static void fsi_i2c_set_scl(struct i2c_adapter *adap, int val) { struct fsi_i2c_port *port = adap->algo_data; - u32 dummy = 0; if (val) - fsi_i2c_write_reg(port->master->fsi, I2C_FSI_SET_SCL, &dummy); + fsi_i2c_write_reg(port->master->fsi, I2C_FSI_SET_SCL, 0); else - fsi_i2c_write_reg(port->master->fsi, I2C_FSI_RESET_SCL, &dummy); + fsi_i2c_write_reg(port->master->fsi, I2C_FSI_RESET_SCL, 0); } static int fsi_i2c_get_sda(struct i2c_adapter *adap) @@ -361,12 +358,11 @@ static int fsi_i2c_get_sda(struct i2c_adapter *adap) static void fsi_i2c_set_sda(struct i2c_adapter *adap, int val) { struct fsi_i2c_port *port = adap->algo_data; - u32 dummy = 0; if (val) - fsi_i2c_write_reg(port->master->fsi, I2C_FSI_SET_SDA, &dummy); + fsi_i2c_write_reg(port->master->fsi, I2C_FSI_SET_SDA, 0); else - fsi_i2c_write_reg(port->master->fsi, I2C_FSI_RESET_SDA, &dummy); + fsi_i2c_write_reg(port->master->fsi, I2C_FSI_RESET_SDA, 0); } static void fsi_i2c_prepare_recovery(struct i2c_adapter *adap) @@ -380,7 +376,7 @@ static void fsi_i2c_prepare_recovery(struct i2c_adapter *adap) return; mode |= I2C_MODE_DIAG; - fsi_i2c_write_reg(port->master->fsi, I2C_FSI_MODE, &mode); + fsi_i2c_write_reg(port->master->fsi, I2C_FSI_MODE, mode); } static void fsi_i2c_unprepare_recovery(struct i2c_adapter *adap) @@ -394,13 +390,12 @@ static void fsi_i2c_unprepare_recovery(struct i2c_adapter *adap) return; mode &= ~I2C_MODE_DIAG; - fsi_i2c_write_reg(port->master->fsi, I2C_FSI_MODE, &mode); + fsi_i2c_write_reg(port->master->fsi, I2C_FSI_MODE, mode); } static int fsi_i2c_reset_bus(struct fsi_i2c_master *i2c, struct fsi_i2c_port *port) { - u32 dummy = 0; u32 stat; int rc; @@ -408,7 +403,7 @@ static int fsi_i2c_reset_bus(struct fsi_i2c_master *i2c, i2c_recover_bus(&port->adapter); /* reset errors */ - rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_ERR, &dummy); + rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_ERR, 0); if (rc) return rc; @@ -423,7 +418,7 @@ static int fsi_i2c_reset_bus(struct fsi_i2c_master *i2c, return 0; /* failed to get command complete; reset engine again */ - rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_I2C, &dummy); + rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_I2C, 0); if (rc) return rc; @@ -433,12 +428,11 @@ static int fsi_i2c_reset_bus(struct fsi_i2c_master *i2c, static int fsi_i2c_reset_engine(struct fsi_i2c_master *i2c, u16 port) { - u32 dummy = 0; u32 mode; int rc; /* reset engine */ - rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_I2C, &dummy); + rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_I2C, 0); if (rc) return rc; @@ -455,14 +449,13 @@ static int fsi_i2c_reset_engine(struct fsi_i2c_master *i2c, u16 port) if (port) { mode &= ~I2C_MODE_PORT; mode |= FIELD_PREP(I2C_MODE_PORT, port); - rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode); + rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, mode); if (rc) return rc; } /* reset busy register; hw workaround */ - dummy = I2C_PORT_BUSY_RESET; - rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_PORT_BUSY, &dummy); + rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_PORT_BUSY, I2C_PORT_BUSY_RESET); if (rc) return rc; @@ -497,7 +490,7 @@ static int fsi_i2c_abort(struct fsi_i2c_port *port, u32 status) return 0; /* write stop command */ - rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_CMD, &cmd); + rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_CMD, cmd); if (rc) return rc; From patchwork Thu Feb 15 22:07:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201791 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp153539dyb; Thu, 15 Feb 2024 14:15:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXooKLd/QYPPLutrsD+32OfpcFFDEmcHKIIArpvcrnj7ZygzRIFxSUHAHganD0IhK1mDI7loyPH/Newooq3CkVrckD2dA== X-Google-Smtp-Source: AGHT+IHge1LRNafzgpwrZtX4VqTAeAmDydAgppvxRAAg/3XLSbzDZclOAHdhSnHsUDycT68/Ilxr X-Received: by 2002:a17:90a:fc86:b0:298:b9fc:323a with SMTP id ci6-20020a17090afc8600b00298b9fc323amr3305994pjb.23.1708035329488; Thu, 15 Feb 2024 14:15:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035329; cv=pass; d=google.com; s=arc-20160816; b=jlhLg9CX1x9YCtp1YK5IFm3IlIcQG2IG6eDsk8vDqtI3ueI7L605+wOv4Vl3KW2fSv clc+fAght0fHPvpbEpIe3JGKBXmJvIIEGTCtQcF/zoKVvPfNO4RuLt2BuCMCpCGb8kQn p9kAGvMpsBId28J5Hf9lhrd1wO6gAwsmh/2ezXDbgS/Sb5C10ljWgyvIL1wudnXzLaHo Q10gSYWlN6Cx6RPe4J/Az3nCTWAHFEtrfH6KV7QYZCQk0ckED3MXAQxCEpKiDnjGtMup WHpd88lmA76gE4eJexEj74BiGpl4Q+PnmA+X5TKKwuEVrRbM+YXseDcuKwaQWzJdXXlW rDwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=njZMmA5i9z9+KJhOIDW6auHi8a7ZavWPmGAbuJxdb8I=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=z8S7ORrcM+dGoz0FIUZTynpAZ0XNBwUqQElduVhn3IiLlwnhS12Hd+BpaJnUJXAQ7v 7w9le9ephG6OxFUnQSvhuJQR5AXw3x9AesSz68P5tYcQrRUs4m/AkY5+KSzpnsyaYih0 kBUXCi7d56FY1v2FITlXCVb5MdyRjWyZyLYcU1RDHNnmCNSp9zWMuL6r2ZJoKFBzn6es dOKD91JZJSKoyGNVh0JpD6YjQiWvGX6OsQhWuM7DXP0qbhEQpR9xozDMi+wuwmSKNIzi eHGXsUuTN31CZ2Ye7zEzWuiXtZI5DB9fj/m9xc7yO4rBASM9TSrq2xewigqKRVbQIs/c Opgw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=LsA5ncRW; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67754-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67754-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id r5-20020a17090ad40500b00298ef3a2dbfsi1866956pju.22.2024.02.15.14.15.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:15:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67754-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=LsA5ncRW; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67754-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67754-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 49FB72822FA for ; Thu, 15 Feb 2024 22:15:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CBB3A152DEF; Thu, 15 Feb 2024 22:08:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="LsA5ncRW" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01144148FE6; Thu, 15 Feb 2024 22:08:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034912; cv=none; b=CsveC6p9ufZh9mCtdTrTc+0X/npCytVrorZwHfwg5BQMxvpkYEMCSDeMWPFD7s+CSdG6D/HkaRaeE7+siTImEPY3bWNOBsuzHusXenjQvZTRBu/Oz4mwC+45sgI3PqNO/fuYoAynEIg1xy+HQgQ0OcNDNgb+apnDel+ShSk/PzU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034912; c=relaxed/simple; bh=BmpHIcdLad4je9edWwtINpVsWPUVd4TCH6j5XSMsz9U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UWIRBwMpMpTuYUDSOMNGNxOgMaYNoiZstcxYFxWlnRpx9WWs0laUrfXcbLGMz1EyH+jLQiEDb/NJPxhHkVeKjOJhrdkuoWuGRXi9A7CXidef/PR7jAV+ZcBKb1FBMrEtA/iD5AcTCDHDrAOXkSfkZKf+N3R6pZk6uhU3NXlzhSE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=LsA5ncRW; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLX97R019465; Thu, 15 Feb 2024 22:08:16 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=njZMmA5i9z9+KJhOIDW6auHi8a7ZavWPmGAbuJxdb8I=; b=LsA5ncRWLayxgJ1/V0yjKJfAyg/cywZIFQSVVc57alEedQqyuK0FUfDPq/utmah/InEb ubhyW/an3v49nHq7XEcrjDULOjd/2qdYiyWMpKpRAnjIsQdUUr5hvauvs09xAcOn+pId XjaO7iQEsH5eCqR2UlZmqmVJj1YTVk7oQgsCmTbueswwrBrd/6jZxl7sMTeeQ6UmCEtw ozEB/WJsHUGi4OQ/2xSNCikWs9Mqm16EX920IRz8a0dLtuD61o6xY3xPEMLYpql47fK8 TS39Lpae6WVUA+QnQ8CRmNtZwlXh82NBEERlENuVDV4JEqigwajrLbYiKEmjMmYAiyvi Zg== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9tmf8n2e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:15 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FJ6raY032589; Thu, 15 Feb 2024 22:08:15 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6kftyues-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:15 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM8Cmh66060748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:14 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8B4B05805A; Thu, 15 Feb 2024 22:08:12 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4124358073; Thu, 15 Feb 2024 22:08:12 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:12 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 30/33] i2c: fsi: Remove list structure of ports Date: Thu, 15 Feb 2024 16:07:56 -0600 Message-Id: <20240215220759.976998-31-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: orgx1qbdtVflLdwnWPDFP_LWBYDZ-E_e X-Proofpoint-ORIG-GUID: orgx1qbdtVflLdwnWPDFP_LWBYDZ-E_e X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004853370528036 X-GMAIL-MSGID: 1791004853370528036 Maintaining a list of ports is unnecessary since they can be managed with the device resource framework. Signed-off-by: Eddie James --- drivers/i2c/busses/i2c-fsi.c | 44 +++++++++--------------------------- 1 file changed, 11 insertions(+), 33 deletions(-) diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c index f237e76d29e6..096dc7e2369f 100644 --- a/drivers/i2c/busses/i2c-fsi.c +++ b/drivers/i2c/busses/i2c-fsi.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -148,14 +147,12 @@ struct fsi_i2c_master { struct fsi_device *fsi; - struct list_head ports; struct mutex lock; u32 clock_div; u8 fifo_size; }; struct fsi_i2c_port { - struct list_head list; struct i2c_adapter adapter; struct fsi_i2c_master *master; u16 port; @@ -327,7 +324,7 @@ static int fsi_i2c_read_fifo(struct fsi_i2c_port *port, struct i2c_msg *msg, static int fsi_i2c_get_scl(struct i2c_adapter *adap) { - struct fsi_i2c_port *port = adap->algo_data; + struct fsi_i2c_port *port = i2c_get_adapdata(adap); u32 stat; fsi_i2c_read_reg(port->master->fsi, I2C_FSI_STAT, &stat); @@ -337,7 +334,7 @@ static int fsi_i2c_get_scl(struct i2c_adapter *adap) static void fsi_i2c_set_scl(struct i2c_adapter *adap, int val) { - struct fsi_i2c_port *port = adap->algo_data; + struct fsi_i2c_port *port = i2c_get_adapdata(adap); if (val) fsi_i2c_write_reg(port->master->fsi, I2C_FSI_SET_SCL, 0); @@ -347,7 +344,7 @@ static void fsi_i2c_set_scl(struct i2c_adapter *adap, int val) static int fsi_i2c_get_sda(struct i2c_adapter *adap) { - struct fsi_i2c_port *port = adap->algo_data; + struct fsi_i2c_port *port = i2c_get_adapdata(adap); u32 stat; fsi_i2c_read_reg(port->master->fsi, I2C_FSI_STAT, &stat); @@ -357,7 +354,7 @@ static int fsi_i2c_get_sda(struct i2c_adapter *adap) static void fsi_i2c_set_sda(struct i2c_adapter *adap, int val) { - struct fsi_i2c_port *port = adap->algo_data; + struct fsi_i2c_port *port = i2c_get_adapdata(adap); if (val) fsi_i2c_write_reg(port->master->fsi, I2C_FSI_SET_SDA, 0); @@ -367,7 +364,7 @@ static void fsi_i2c_set_sda(struct i2c_adapter *adap, int val) static void fsi_i2c_prepare_recovery(struct i2c_adapter *adap) { - struct fsi_i2c_port *port = adap->algo_data; + struct fsi_i2c_port *port = i2c_get_adapdata(adap); u32 mode; int rc; @@ -381,7 +378,7 @@ static void fsi_i2c_prepare_recovery(struct i2c_adapter *adap) static void fsi_i2c_unprepare_recovery(struct i2c_adapter *adap) { - struct fsi_i2c_port *port = adap->algo_data; + struct fsi_i2c_port *port = i2c_get_adapdata(adap); u32 mode; int rc; @@ -594,7 +591,7 @@ static int fsi_i2c_wait(struct fsi_i2c_port *port, struct i2c_msg *msg, static int fsi_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) { - struct fsi_i2c_port *port = adap->algo_data; + struct fsi_i2c_port *port = i2c_get_adapdata(adap); unsigned long start_time; struct i2c_msg *msg; int rc; @@ -679,7 +676,6 @@ static int fsi_i2c_probe(struct device *dev) mutex_init(&i2c->lock); i2c->fsi = to_fsi_dev(dev); - INIT_LIST_HEAD(&i2c->ports); i2c->clock_div = I2C_DEFAULT_CLK_DIV; lbus = fsi_device_local_bus_frequency(i2c->fsi); @@ -706,38 +702,30 @@ static int fsi_i2c_probe(struct device *dev) ports = FIELD_GET(I2C_STAT_MAX_PORT, stat) + 1; dev_dbg(dev, "I2C master has %d ports\n", ports); - for (port_no = 0; port_no < ports; port_no++) { + port = devm_kzalloc(dev, sizeof(*port) * ports, GFP_KERNEL); + for (port_no = 0; port_no < ports; port_no++, port++) { np = fsi_i2c_find_port_of_node(dev->of_node, port_no); if (!of_device_is_available(np)) continue; - port = kzalloc(sizeof(*port), GFP_KERNEL); - if (!port) { - of_node_put(np); - break; - } - port->master = i2c; port->port = port_no; + i2c_set_adapdata(&port->adapter, port); port->adapter.owner = THIS_MODULE; port->adapter.dev.of_node = np; port->adapter.dev.parent = dev; port->adapter.algo = &fsi_i2c_algorithm; port->adapter.bus_recovery_info = &fsi_i2c_bus_recovery_info; - port->adapter.algo_data = port; snprintf(port->adapter.name, sizeof(port->adapter.name), "i2c_bus-%u", port_no); - rc = i2c_add_adapter(&port->adapter); + rc = devm_i2c_add_adapter(dev, &port->adapter); if (rc < 0) { dev_err(dev, "Failed to register adapter: %d\n", rc); - kfree(port); continue; } - - list_add(&port->list, &i2c->ports); } dev_set_drvdata(dev, i2c); @@ -746,16 +734,6 @@ static int fsi_i2c_probe(struct device *dev) static int fsi_i2c_remove(struct device *dev) { - struct fsi_i2c_master *i2c = dev_get_drvdata(dev); - struct fsi_i2c_port *port; - struct fsi_i2c_port *tmp; - - list_for_each_entry_safe(port, tmp, &i2c->ports, list) { - list_del(&port->list); - i2c_del_adapter(&port->adapter); - kfree(port); - } - return 0; } From patchwork Thu Feb 15 22:07:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201805 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp156431dyb; Thu, 15 Feb 2024 14:21:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX1O0vOgUSl4KV8sll8xPmdgBrHUxX6laNMlWfg/U3aB/JohHXeVTr3TZnqkBZhx5JOwjCY1NdxoO9JNAc07U3os/OpGw== X-Google-Smtp-Source: AGHT+IHBAI8Rsa8lzS9XK0BUc8QC1heEVrP8/qebDnx5eFUm8cfxiA3HGqUNWTh7pnspt6CTwGye X-Received: by 2002:a17:906:b803:b0:a3d:d237:8577 with SMTP id dv3-20020a170906b80300b00a3dd2378577mr121400ejb.7.1708035715188; Thu, 15 Feb 2024 14:21:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035715; cv=pass; d=google.com; s=arc-20160816; b=sU3KbOwlMUE5EhwCk2JOLxMgbj2MWufcHnyASO7LKTsIWy00hvsPrfdqt/XAGBTvl3 6SEpaTaDHcKkMrwafS1wlnqct5ZrYv5ebX2Ud/pQn01Yvdur/tBXyTadfN5/Wd0SxnM+ HCPq+ZJZfKZMLjXyJxYiyF0GWEVqaMF8X/3el8fPWlPDDzvqiMRc65bs4gcRJaQNt87v wyV2dCqy7AUuWMLJZD124577DCmm1/HyPg5i/SOHU7gDGHuoxjEPilIjmYr/YnM85iR7 qlcBcINilJ33wFeotqFhIJnt5GaqVJT5VWDTaIOSWbwL2l4I4vDnCK7fx5Y3SCHagRYc OTFw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=VTP7z+tQ2W8GOsBuCAI+ahfXY5pZN8Q0NRIJ8nxWHJo=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=efz6xL09vmo964mAPV5GKFAPwjpFYKdtylKUU4Aorx5Y5NDRbnP4Gw4XQ7oU9nnehl r74qer4m2JCc/7sTvm9x+HP8F7X0i3ohsuP86eieOdK8NZupPHhXl03Dp4RirW2i23CK uW0IbXLzHUJfh+BQXQmemnGSmL0fhW4HZ1+G3GSbTIcTWF3WFCkJEOU9jyo0eQiMd2XG gS57pU+sM332qKEDMWEhnzrD4w8Q+Q/KuvnBq7ZNzOnVurp7YZBEPGHe4fUs3EvaOSuc qVoJQn/Ani7QliZznPhZUHCjJXcX6xp33Aw9QPxLJZKBuMlbe29/w7H1hOHBqz7fz4yM 8ecg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=aUpU1rEt; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67756-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67756-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o15-20020a170906600f00b00a3cf0dcf298si1005801ejj.761.2024.02.15.14.21.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:21:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67756-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=aUpU1rEt; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67756-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67756-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 987FA1F28510 for ; Thu, 15 Feb 2024 22:15:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85A10151CFF; Thu, 15 Feb 2024 22:08:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="aUpU1rEt" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82F0A14901C; Thu, 15 Feb 2024 22:08:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034912; cv=none; b=C+XKjCcIFNFWaLnKVn4jZ4fukIPFoq1Hpo9nkTilDLtVVjgWBU5Oe5kmqunxEZNJI48cKtaRQ/UNRa7rcnSoHRsq9ZLTrWMFHXLjXK1xg4mpC0CFmwzx9Z5x8xks5F4ZhleseEQpxd9xJqEt4FMH53J6SP/v5blVH6jAEBGyQnY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034912; c=relaxed/simple; bh=H95OXKDiOnZPDBQirsADlzhMc6VAfrwQDtpLN9WMyRg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=O5p6ZwqAGCuIPzIazchOACipHOThkCB7jgjR+dC/tB3ssn4FZtADjHjO5043FM8uIzEt33T9anm0x6eLTZStkM0oryOX6AEaLQlPpW+YNB4AfVD/K+05iEQHX5wLxDjNwb8F88YZvJLZLQmZS6bjOeIVbzXwa1td6VK+F1+1rv4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=aUpU1rEt; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FLPhFN030019; Thu, 15 Feb 2024 22:08:18 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=VTP7z+tQ2W8GOsBuCAI+ahfXY5pZN8Q0NRIJ8nxWHJo=; b=aUpU1rEt26Ixm4wuXt4ARN+OBDwsdN/LfQSQmCjbUGrD7xkBj1r3W4JOTRYmcDLBk4mO ePXHlLuflhKQM2YVaTdAa6Oaj+G2F16rpmIAtMW3Tj4ttagB+tgfHMoO5coEKWU0DlN6 jGXFtz66GZ2G4cmPHLnKZZ7gUSt7rjj+3trXLQgJ0zOb2XFlwfWmvGyX9BBN6T22p4s7 rmFg34JIab+F97yEj+Zp+vctoGY5RezhF/IoqZAoDLXxEEFLN3WMSQBf5tmz8EpYX06e nHWRH71YsqStw/oSWVoEl/PDijUbQXHhZVOlnPXdN1oKuU/YPYzR5Evl7MNux1PJQSXt UQ== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9s0tjy8v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:17 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FJBGLv004329; Thu, 15 Feb 2024 22:08:17 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6kv0qtng-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:16 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM8ED815729300 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:16 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DE14158073; Thu, 15 Feb 2024 22:08:12 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9371E58064; Thu, 15 Feb 2024 22:08:12 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:12 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 31/33] i2c: fsi: Define a function to check status error bits Date: Thu, 15 Feb 2024 16:07:57 -0600 Message-Id: <20240215220759.976998-32-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: HJ1k8QJcGw75HAqAiCnMmu28CeQrKR_Y X-Proofpoint-ORIG-GUID: HJ1k8QJcGw75HAqAiCnMmu28CeQrKR_Y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=928 clxscore=1015 suspectscore=0 phishscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791005258451705605 X-GMAIL-MSGID: 1791005258451705605 This will be used more than once with interrupt support, so split the error bit checks into a function. Signed-off-by: Eddie James --- drivers/i2c/busses/i2c-fsi.c | 38 ++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c index 096dc7e2369f..5f524fb6f0f8 100644 --- a/drivers/i2c/busses/i2c-fsi.c +++ b/drivers/i2c/busses/i2c-fsi.c @@ -507,6 +507,26 @@ static int fsi_i2c_abort(struct fsi_i2c_port *port, u32 status) return -ETIMEDOUT; } +static int fsi_i2c_error_status_to_rc(u32 status) +{ + if (status & I2C_STAT_INV_CMD) + return -EINVAL; + + if (status & (I2C_STAT_PARITY | I2C_STAT_BE_OVERRUN | I2C_STAT_BE_ACCESS)) + return -EPROTO; + + if (status & I2C_STAT_NACK) + return -ENXIO; + + if (status & I2C_STAT_LOST_ARB) + return -EAGAIN; + + if (status & I2C_STAT_STOP_ERR) + return -EBADMSG; + + return -EIO; +} + static int fsi_i2c_handle_status(struct fsi_i2c_port *port, struct i2c_msg *msg, u32 status) { @@ -518,23 +538,7 @@ static int fsi_i2c_handle_status(struct fsi_i2c_port *port, if (rc) return rc; - if (status & I2C_STAT_INV_CMD) - return -EINVAL; - - if (status & (I2C_STAT_PARITY | I2C_STAT_BE_OVERRUN | - I2C_STAT_BE_ACCESS)) - return -EPROTO; - - if (status & I2C_STAT_NACK) - return -ENXIO; - - if (status & I2C_STAT_LOST_ARB) - return -EAGAIN; - - if (status & I2C_STAT_STOP_ERR) - return -EBADMSG; - - return -EIO; + return fsi_i2c_error_status_to_rc(status); } if (status & I2C_STAT_DAT_REQ) { From patchwork Thu Feb 15 22:07:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201790 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp153499dyb; Thu, 15 Feb 2024 14:15:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXPiz33ojo8loXcfPQBuSf0Y2eqnRG/TK+MPEoPwFHK6FWsFQNlRgFHAy6BiOWPeQn1aT0YAOIecszwTLN3TeJafd3P6Q== X-Google-Smtp-Source: AGHT+IGTuN5jQYxFv2/CkV1whUIcNJWwxaqppMh7d57ufH0/wdIJl0ZDPLmqnxmVkjDxm2lTJTv+ X-Received: by 2002:a17:902:ea0c:b0:1da:192f:3ecc with SMTP id s12-20020a170902ea0c00b001da192f3eccmr3661507plg.53.1708035323258; Thu, 15 Feb 2024 14:15:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035323; cv=pass; d=google.com; s=arc-20160816; b=kUWpEDoDjkezvNsmYhpW/mZerN4LaJGT+fvXm+jATUxjrkGSDM6MxieoPn/bKMy9QL 4qPHI4jdFW5sE17JNhRsYJxRw0eoCH80rgk2baNH0o4aP2G14Ry16Bs9Ltw3a2a7E3RL 8v9KXdkru8clAVsDS1LqGPDPbI7+JtSGHTxQChpNU0GWKlW5eM/0/6IizHCsIzjsAmUN r/X4C9ZTVJk3J91I1tvj7K1r/OSSWr5eJ/M/6mQcLCsg9kWPItpy1kFxnoK9syVapt+N emVAmSJUaqr45qKpdhZsFFdmMEh9FQFpy6Hs4KQnkXUUZrnvAMAhmpUGF0CR5NjKQ55f Aq8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=jHq/vBDBbZBSuhSZdVDjxpYwsAaHsSkR8YTxz+PKabo=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=oTULMDMvpCi4uG2dxg07rFbna+WcizbEHjhisjG0kOYCRL/stBGUJo7ncK33NaQbco VWTnLSkRc/pYF0R1/70mnGEgLPxDoqptrBmdJl3gpss0x90AfIrF9YI5loCcZJI3Hclp zQL/Efi2jKqGfXNjWI/XO+gM8vJm7mVoCLBsBmfLfD0EEtW5uxPqvgpo8vOHS8zjow60 FN832kJbpzhoCEqR4d/meUM1aVVaTE9QLCcl9T/7b6/ypqi83XaW37FhXeTbrtxUbH3e IrVcGRP2DBzYVBQpNrJ4IR+4soPjTamtr6J9kVLkkcodGRTIjDaMPc+FHFqkL8Th2byo /MXw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=cMyaeVCJ; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67753-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67753-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j19-20020a170902759300b001d9a1109d63si1695495pll.525.2024.02.15.14.15.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:15:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67753-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=cMyaeVCJ; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67753-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67753-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0EB3728153E for ; Thu, 15 Feb 2024 22:15:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90FF7152DE5; Thu, 15 Feb 2024 22:08:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="cMyaeVCJ" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BD601487D8; Thu, 15 Feb 2024 22:08:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034911; cv=none; b=KqeWcnZRZaqMjaTKkZuh6PiPHbQaVtiGLC4rtYbTI7mar7QQKW9eIykfPO7oLOlhIdegmGqnU1hTQJcQEavFExiffw6FyrupeHA35C2Ra0JmbCmnCla9sNWHN/H3C31HP/k6nAxc1UeJ+KeT5/82aU+qR1uL/Omj+F/RL7poeCQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034911; c=relaxed/simple; bh=6ORCo3+k9OdhTzhZOX/OvaI7dLnhbXmu+cXgKL7siCc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LvLK2dAi5/maOXg27i4U2mlioa7Yn6cDjCxTcxz1f9dfv+H2+qdpLCXh4MrKKJZhSm0Ol3ow29gUzGstcS695du2GODvg6k2q3lQFiOSY+AJhPZTOiA2ZiuKO5O6N87UQKM6bjkicMrUNh6g4dqYzE0fTSHM1zt0Nm9hUUGjr78= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=cMyaeVCJ; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 41FM0qdo018830; Thu, 15 Feb 2024 22:08:17 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=jHq/vBDBbZBSuhSZdVDjxpYwsAaHsSkR8YTxz+PKabo=; b=cMyaeVCJwpQZBlLfy462KAuRrC5YUbqTicoHy7GXpCoF2xOSwcj5EoMvEh9+S7MhdMb1 OEg45hr8Z6GPEAtHJfxTG27l2lFufZpGAsmhmtwv/Y3258+EMeZjeFxaU5994HxB8JHV Xi3wOgFFD39+P8z1n8D9kAsl+ViLouz6hwJT29m0F8cMTpLP5efsjjkWtssuxOn86aPB JR3bKRilYQXoPV1ZW3ETwiEuLH1aV2jQvoJzHANTjkzrT/vs7JR5oAXzrTNxh1Rn7xJO 4VQP3jf5FyVqnkr+I47RExSfvzPlyAJyjYLCu8u8B7ShSBf8PtdBdly5TDiYo1zH/7CI MQ== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9u1bg6dv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:16 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLuP2h004258; Thu, 15 Feb 2024 22:08:15 GMT Received: from smtprelay03.wdc07v.mail.ibm.com ([172.16.1.70]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6kv0qtnc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:15 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay03.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM8Dqn12714606 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:15 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3BEF358079; Thu, 15 Feb 2024 22:08:13 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E661B5806A; Thu, 15 Feb 2024 22:08:12 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:12 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 32/33] i2c: fsi: Add boolean for skip stop command on abort Date: Thu, 15 Feb 2024 16:07:58 -0600 Message-Id: <20240215220759.976998-33-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: p7PIRIlbszKwDr-GX9bH6oc5Dg4E_sKy X-Proofpoint-ORIG-GUID: p7PIRIlbszKwDr-GX9bH6oc5Dg4E_sKy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 adultscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004847221374916 X-GMAIL-MSGID: 1791004847221374916 In preparation for interrupt support, store whether to skip the final stop command during the abort procedure instead of checking the previously read status register in the abort function. Signed-off-by: Eddie James --- drivers/i2c/busses/i2c-fsi.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c index 5f524fb6f0f8..33f4e64cb60b 100644 --- a/drivers/i2c/busses/i2c-fsi.c +++ b/drivers/i2c/busses/i2c-fsi.c @@ -116,6 +116,9 @@ #define I2C_STAT_ANY_RESP (I2C_STAT_ERR | \ I2C_STAT_DAT_REQ | \ I2C_STAT_CMD_COMP) +#define I2C_STAT_SKIP_STOP (I2C_STAT_PARITY | \ + I2C_STAT_LOST_ARB | \ + I2C_STAT_STOP_ERR) /* extended status register */ #define I2C_ESTAT_FIFO_SZ GENMASK(31, 24) @@ -150,6 +153,7 @@ struct fsi_i2c_master { struct mutex lock; u32 clock_div; u8 fifo_size; + bool skip_stop; }; struct fsi_i2c_port { @@ -459,31 +463,30 @@ static int fsi_i2c_reset_engine(struct fsi_i2c_master *i2c, u16 port) return 0; } -static int fsi_i2c_abort(struct fsi_i2c_port *port, u32 status) +static int fsi_i2c_abort(struct fsi_i2c_port *port) { struct fsi_i2c_master *i2c = port->master; u32 cmd = I2C_CMD_WITH_STOP; unsigned long start; - u32 stat; + u32 status; int rc; rc = fsi_i2c_reset_engine(i2c, port->port); if (rc) return rc; - rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_STAT, &stat); + rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_STAT, &status); if (rc) return rc; /* if sda is low, peform full bus reset */ - if (!(stat & I2C_STAT_SDA_IN)) { + if (!(status & I2C_STAT_SDA_IN)) { rc = fsi_i2c_reset_bus(i2c, port); if (rc) return rc; } - /* skip final stop command for these errors */ - if (status & (I2C_STAT_PARITY | I2C_STAT_LOST_ARB | I2C_STAT_STOP_ERR)) + if (i2c->skip_stop) return 0; /* write stop command */ @@ -534,7 +537,8 @@ static int fsi_i2c_handle_status(struct fsi_i2c_port *port, int rc; if (status & I2C_STAT_ERR) { - rc = fsi_i2c_abort(port, status); + port->master->skip_stop = status & I2C_STAT_SKIP_STOP; + rc = fsi_i2c_abort(port); if (rc) return rc; From patchwork Thu Feb 15 22:07:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201797 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp154168dyb; Thu, 15 Feb 2024 14:16:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW6rsMB/5/L8ibJbnqaYHAH5r1HXxl8/LykAKGsFZFO+qnkLn39iE8u+16Qu09jlxodX7d9lYHk3heBOCloyw8rk7dbRw== X-Google-Smtp-Source: AGHT+IGw8gRR//I90xS3zhrz+5hIOJ5+XR5LTg2QyCrNHXJLCyBKZyj062bmpcAkp9L693SToyQT X-Received: by 2002:a05:6a21:3982:b0:19e:a1a3:b14 with SMTP id ad2-20020a056a21398200b0019ea1a30b14mr4794795pzc.1.1708035409353; Thu, 15 Feb 2024 14:16:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035409; cv=pass; d=google.com; s=arc-20160816; b=qPneaJLytHbdhQa2yrjBsQHODp8vdBfwUIHvPkr1d119+22BGD+FhdxlAOAJwAKiw2 k5VLWEG+VQEH036TMdsNaH3kklZdeCyEXI2nAj8F7XV6VbkhDwAebfiasBsDVL8D6URz b72bkmUORh1wsIBeo+u4qnS2dCTKNdMCfFEnhkPaxsqXeEkIaqaBaQqqZzUtOSBljI19 iMKs0RhxxLOU7YXQD5+95d9zuyst9ZCNVo7iCOCzyC60Mu+RV55JNhWNEyjFZ3E34Ntz uD+LrUlEEDynmCQSPdc7QbigjokhDYxWNxgH45lQyaPMr1k5wmv8S3o11Z3Ze4ua5W/w 7FyQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=GgJ7F+dcd0WCLJ0MXE682Wr0l+kLhInQlwRytq3asIY=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=ZKQA5nOXHcGFlC5hotB/nVHKCU6J61czAzeGleRhSwNkJzJF4OpNm8CBxOuu/2krRT 4kG102acg5Gx9/bbGqXKi/esB6SSdxQjxJcMWtjR39QKYyG9oVU1e3++uSmW36aUMV4x dwj4DD8mdSXlsTsoMcS4kfwFSGFwSkjVOdiZA5OmD913dfxHS4IA3pHuNy2b6fVfdWgi wFSBimtCuT8FZIMw4202JmR3ZFT/IixElmvebB2Y3CbpC3t9BKdGcNQiQTI1lZSjuaTL 0vVlrYodXA8zQVmf9B7W8xjY9QbrBDJld0shfG0wyTr4idxepldJsJztkIiOw8kW/fTq m7Yg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=kQtbPlQM; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67761-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67761-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bq19-20020a056a02045300b005cf5bf8e7a5si1805748pgb.430.2024.02.15.14.16.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:16:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67761-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=kQtbPlQM; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-67761-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67761-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2CD54282F98 for ; Thu, 15 Feb 2024 22:16:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD1C6153BD8; Thu, 15 Feb 2024 22:08:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="kQtbPlQM" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8FD9714A4C4; Thu, 15 Feb 2024 22:08:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034916; cv=none; b=o3JuFYrFN+RKRMb3JdeBlYO9GNGQNaILBeh1s5RE2D6IYPCbol2G7s3H1UM395cs+7ksukt4GQ4n3ZA6R4yT25u9JfQYl/OmoRv4aX5L+vq0/5Kwnr5IyYrj1+obswFAwJ5o6bJOD2tHJViWiZNJfZjFZXs6i0+FVRUZRaRgeOU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034916; c=relaxed/simple; bh=r7i6r1TAnXFKp6Ud7ZNcT3dqvowjChmj4bvNXv7VZl8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WQ7vmF1Vb2uenz0Hbmo8JI2Nmx6ZiYuBIvQmautwJZ986+sXqn1+TcWIjtBsWpED3H5Pn2a1lwHOvYG1Okwdxzd5JLjeWfTatILvWN8Xb0R0btlUx0z9SbUhR5outCLSPN1U192gNcRcI9zncNuJnOunwHoIl9jxMLgfQhy1a6E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=kQtbPlQM; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41FKYRVv017474; Thu, 15 Feb 2024 22:08:18 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=GgJ7F+dcd0WCLJ0MXE682Wr0l+kLhInQlwRytq3asIY=; b=kQtbPlQMw61Mp2OWBXpSBFk5rh6FkKKimdufv5nJ66EHXHdo52il3I2ABhCLHYn1An6d seC8bBdXsYTY9MoqliuAfrPUQ06pOH9IZqHHplag3vrgkR6+wbEjeiEcE8hAi3Ci/1FF qMRaGTdT2cxC3LOTiSyZWz9QcWco75a796MzG8bEBsFgM6RPzPNrp8reWG3bKA/8VbSw yfltFIaDo89DS9damn0QTBRfKhq4OfgtmdgVQNzv30loDbycEw2QSsoZbYAOFpdmOH/s fvVjzIAlFME1tujEe/gTlXVom8IiPJt/oC85Y0eRTvExHc9ipQ2/ODxyRKdLrOknzjq1 Dw== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9q0v5yjp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:17 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FKZ6JT009680; Thu, 15 Feb 2024 22:08:16 GMT Received: from smtprelay03.wdc07v.mail.ibm.com ([172.16.1.70]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6npm7822-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:16 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay03.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM8D2e62783830 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:16 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 95CC35807D; Thu, 15 Feb 2024 22:08:13 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 44D275807A; Thu, 15 Feb 2024 22:08:13 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:13 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 33/33] i2c: fsi: Add interrupt support Date: Thu, 15 Feb 2024 16:07:59 -0600 Message-Id: <20240215220759.976998-34-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: LODkJAAOMushShHGwjpoPCDld1qWtOWv X-Proofpoint-GUID: LODkJAAOMushShHGwjpoPCDld1qWtOWv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 clxscore=1015 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004937055218939 X-GMAIL-MSGID: 1791004937055218939 Optionally support interrupts from the I2C controller so that the driver can wait rather than poll the status register. Signed-off-by: Eddie James --- drivers/i2c/busses/i2c-fsi.c | 215 ++++++++++++++++++++++++++++++--- include/trace/events/i2c_fsi.h | 45 +++++++ 2 files changed, 245 insertions(+), 15 deletions(-) create mode 100644 include/trace/events/i2c_fsi.h diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c index 33f4e64cb60b..096edeaa3312 100644 --- a/drivers/i2c/busses/i2c-fsi.c +++ b/drivers/i2c/busses/i2c-fsi.c @@ -23,6 +23,7 @@ #include #include #include +#include #define FSI_ENGID_I2C 0x7 @@ -87,6 +88,7 @@ #define I2C_INT_STOP_ERR BIT(7) #define I2C_INT_BUSY BIT(6) #define I2C_INT_IDLE BIT(5) +#define I2C_INT_ANY GENMASK(15, 7) /* status register */ #define I2C_STAT_INV_CMD BIT(31) @@ -148,21 +150,35 @@ /* choose timeout length from legacy driver; it's well tested */ #define I2C_ABORT_TIMEOUT msecs_to_jiffies(100) +struct fsi_i2c_port; + struct fsi_i2c_master { struct fsi_device *fsi; + struct fsi_i2c_port *port; struct mutex lock; + wait_queue_head_t wait; u32 clock_div; u8 fifo_size; + bool interrupts; bool skip_stop; + bool abort; }; struct fsi_i2c_port { struct i2c_adapter adapter; struct fsi_i2c_master *master; + struct i2c_msg *msgs; + int nmsgs; + int rc; + int i; u16 port; u16 xfrd; + bool wake; }; +#define CREATE_TRACE_POINTS +#include + static int fsi_i2c_read_reg(struct fsi_device *fsi, unsigned int reg, u32 *data) { @@ -192,7 +208,7 @@ static int fsi_i2c_dev_init(struct fsi_i2c_master *i2c) u32 watermark; int rc; - /* since we use polling, disable interrupts */ + /* start with interrupts disabled */ rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_INT_MASK, 0); if (rc) return rc; @@ -236,22 +252,24 @@ static int fsi_i2c_set_port(struct fsi_i2c_port *port) return fsi_i2c_write_reg(fsi, I2C_FSI_RESET_ERR, 0); } -static int fsi_i2c_start(struct fsi_i2c_port *port, struct i2c_msg *msg, - bool stop) +static int fsi_i2c_start(struct fsi_i2c_port *port) { u32 cmd = I2C_CMD_WITH_START | I2C_CMD_WITH_ADDR; + struct i2c_msg *msg = &port->msgs[port->i]; port->xfrd = 0; if (msg->flags & I2C_M_RD) cmd |= I2C_CMD_READ; - if (stop || msg->flags & I2C_M_STOP) + if ((port->i == (port->nmsgs - 1)) || (msg->flags & I2C_M_STOP)) cmd |= I2C_CMD_WITH_STOP; cmd |= FIELD_PREP(I2C_CMD_ADDR, msg->addr); cmd |= FIELD_PREP(I2C_CMD_LEN, msg->len); + trace_i2c_fsi_start(port, cmd); + return fsi_i2c_write_reg(port->master->fsi, I2C_FSI_CMD, cmd); } @@ -489,11 +507,38 @@ static int fsi_i2c_abort(struct fsi_i2c_port *port) if (i2c->skip_stop) return 0; + if (i2c->interrupts) { + i2c->abort = true; + port->wake = false; + + rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_INT_MASK, I2C_INT_ANY); + if (rc) + return rc; + } + /* write stop command */ rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_CMD, cmd); if (rc) return rc; + if (i2c->interrupts) { + rc = wait_event_interruptible_timeout(i2c->wait, port->wake, I2C_ABORT_TIMEOUT); + if (rc > 0) + return port->rc; + + fsi_i2c_write_reg(i2c->fsi, I2C_FSI_INT_MASK, 0); + + if (!rc) { + rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_STAT, &status); + if (!rc && (status & I2C_STAT_CMD_COMP)) + rc = 0; + else + rc = -ETIMEDOUT; + } + + return rc; + } + /* wait until we see command complete in the master */ start = jiffies; do { @@ -564,8 +609,59 @@ static int fsi_i2c_handle_status(struct fsi_i2c_port *port, return 0; } -static int fsi_i2c_wait(struct fsi_i2c_port *port, struct i2c_msg *msg, - unsigned long timeout) +static int fsi_i2c_wait_irq(struct fsi_i2c_port *port, unsigned long timeout) +{ + int rc; + + port->wake = false; + + rc = fsi_i2c_write_reg(port->master->fsi, I2C_FSI_INT_MASK, I2C_INT_ANY); + if (rc) + return rc; + + rc = wait_event_interruptible_timeout(port->master->wait, port->wake, timeout); + if (rc > 0) { + rc = port->rc; + + if (port->master->abort) { + int rc2 = fsi_i2c_abort(port); + + if (rc2) + return rc2; + } + + return rc; + } + + /* + * The interrupt handler should turn off interrupts once it's done, but in this + * case we timed out or were interrupted, so mask them off here. + */ + fsi_i2c_write_reg(port->master->fsi, I2C_FSI_INT_MASK, 0); + + if (!rc) { + u32 status; + + rc = fsi_i2c_read_reg(port->master->fsi, I2C_FSI_STAT, &status); + if (!rc && (status & I2C_STAT_ANY_RESP)) { + rc = fsi_i2c_handle_status(port, &port->msgs[port->i], status); + if (rc < 0) + return rc; + + /* cmd complete and all data xfrd */ + if (rc == port->msgs[port->i].len) + return 0; + + rc = -ETIMEDOUT; + } else { + rc = -ETIMEDOUT; + } + } + + return rc; +} + +static int fsi_i2c_wait_poll(struct fsi_i2c_port *port, unsigned long timeout) { unsigned long start = jiffies; u32 status; @@ -578,12 +674,12 @@ static int fsi_i2c_wait(struct fsi_i2c_port *port, struct i2c_msg *msg, return rc; if (status & I2C_STAT_ANY_RESP) { - rc = fsi_i2c_handle_status(port, msg, status); + rc = fsi_i2c_handle_status(port, &port->msgs[port->i], status); if (rc < 0) return rc; /* cmd complete and all data xfrd */ - if (rc == msg->len) + if (rc == port->msgs[port->i].len) return 0; /* need to xfr more data, but maybe don't need wait */ @@ -601,9 +697,7 @@ static int fsi_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, { struct fsi_i2c_port *port = i2c_get_adapdata(adap); unsigned long start_time; - struct i2c_msg *msg; int rc; - int i; mutex_lock(&port->master->lock); @@ -611,21 +705,28 @@ static int fsi_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, if (rc) goto unlock; - for (i = 0; i < num; i++) { - msg = msgs + i; + port->master->port = port; + port->master->abort = false; + port->msgs = msgs; + port->nmsgs = num; + for (port->i = 0; port->i < num; ++port->i) { start_time = jiffies; - rc = fsi_i2c_start(port, msg, i == num - 1); + rc = fsi_i2c_start(port); if (rc) goto unlock; - rc = fsi_i2c_wait(port, msg, - adap->timeout - (jiffies - start_time)); + if (port->master->interrupts) + rc = fsi_i2c_wait_irq(port, adap->timeout - (jiffies - start_time)); + else + rc = fsi_i2c_wait_poll(port, adap->timeout - (jiffies - start_time)); if (rc) goto unlock; } unlock: + port->msgs = NULL; + port->master->port = NULL; mutex_unlock(&port->master->lock); return rc ? : num; } @@ -636,6 +737,85 @@ static u32 fsi_i2c_functionality(struct i2c_adapter *adap) I2C_FUNC_SMBUS_EMUL | I2C_FUNC_SMBUS_BLOCK_DATA; } +static irqreturn_t fsi_i2c_irq(int irq, void *data) +{ + struct fsi_i2c_master *i2c = data; + struct fsi_i2c_port *port; + struct i2c_msg *msg; + u32 status; + int rc; + + rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_INT_MASK, 0); + if (rc) + return IRQ_NONE; + + if (!i2c->port) + return IRQ_HANDLED; + + port = i2c->port; + rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_STAT, &status); + if (rc) + goto wake; + + trace_i2c_fsi_irq(port, status); + + if (i2c->abort) { + if (status & I2C_STAT_CMD_COMP) { + port->wake = true; + goto done; + } else { + rc = fsi_i2c_error_status_to_rc(status); + goto wake; + } + } + + if (status & I2C_STAT_ERR) { + i2c->abort = true; + i2c->skip_stop = status & I2C_STAT_SKIP_STOP; + rc = fsi_i2c_error_status_to_rc(status); + goto wake; + } + + if (!port->msgs || port->i >= port->nmsgs) { + rc = -ENODEV; + goto wake; + } + + msg = &port->msgs[port->i]; + if (status & I2C_STAT_DAT_REQ) { + u8 fifo_count = FIELD_GET(I2C_STAT_FIFO_COUNT, status); + + if (msg->flags & I2C_M_RD) + rc = fsi_i2c_read_fifo(port, msg, fifo_count); + else + rc = fsi_i2c_write_fifo(port, msg, fifo_count); + } else if (status & I2C_STAT_CMD_COMP) { + if (port->xfrd < msg->len) { + rc = -ENODATA; + } else { + ++port->i; + if (port->i < port->nmsgs) { + rc = fsi_i2c_start(port); + } else { + port->wake = true; + goto done; + } + } + } + + if (!rc) + rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_INT_MASK, I2C_INT_ANY); + +wake: + if (rc) + port->wake = true; +done: + port->rc = rc; + if (port->wake) + wake_up_interruptible_all(&i2c->wait); + return IRQ_HANDLED; +} + static struct i2c_bus_recovery_info fsi_i2c_bus_recovery_info = { .recover_bus = i2c_generic_scl_recovery, .get_scl = fsi_i2c_get_scl, @@ -683,6 +863,7 @@ static int fsi_i2c_probe(struct device *dev) return -ENOMEM; mutex_init(&i2c->lock); + init_waitqueue_head(&i2c->wait); i2c->fsi = to_fsi_dev(dev); i2c->clock_div = I2C_DEFAULT_CLK_DIV; @@ -707,6 +888,10 @@ static int fsi_i2c_probe(struct device *dev) if (rc) return rc; + rc = fsi_device_request_irq(i2c->fsi, fsi_i2c_irq, i2c); + if (!rc) + i2c->interrupts = true; + ports = FIELD_GET(I2C_STAT_MAX_PORT, stat) + 1; dev_dbg(dev, "I2C master has %d ports\n", ports); diff --git a/include/trace/events/i2c_fsi.h b/include/trace/events/i2c_fsi.h new file mode 100644 index 000000000000..691fb2adf454 --- /dev/null +++ b/include/trace/events/i2c_fsi.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM i2c_fsi + +#if !defined(_TRACE_I2C_FSI_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_I2C_FSI_H + +#include + +TRACE_EVENT(i2c_fsi_irq, + TP_PROTO(const struct fsi_i2c_port *port, uint32_t status), + TP_ARGS(port, status), + TP_STRUCT__entry( + __field(int, bus) + __field(int, msg_idx) + __field(uint32_t, status) + ), + TP_fast_assign( + __entry->bus = port->adapter.nr; + __entry->msg_idx = port->i; + __entry->status = status; + ), + TP_printk("i2c-%d status: %08x", __entry->bus, __entry->status) +); + +TRACE_EVENT(i2c_fsi_start, + TP_PROTO(const struct fsi_i2c_port *port, uint32_t command), + TP_ARGS(port, command), + TP_STRUCT__entry( + __field(int, bus) + __field(int, msg_idx) + __field(uint32_t, command) + ), + TP_fast_assign( + __entry->bus = port->adapter.nr; + __entry->msg_idx = port->i; + __entry->command = command; + ), + TP_printk("i2c-%d command: %08x", __entry->bus, __entry->command) +); + +#endif + +#include