Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp568937lqr; Wed, 5 Jun 2024 14:25:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWa1scTbsRcX+uF8gQoBwFS8uIaMqMuKrOer0fJPj5A9hRADhDG1ws2qG63ud4UVMMvpcc6ksfKY6H5KnSe1cbJruz693yMTjgXKJq9Cw== X-Google-Smtp-Source: AGHT+IE4M7QmE1j5rjZ7sq8EpS61G5urW8LNKqVfiA0w+cKf7t/ITlcTEPBxdUdu5r5FfRbzz8Il X-Received: by 2002:a0c:9c0e:0:b0:6b0:4d52:3ad2 with SMTP id 6a1803df08f44-6b04d523c25mr5163856d6.53.1717622713806; Wed, 05 Jun 2024 14:25:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717622713; cv=pass; d=google.com; s=arc-20160816; b=VklHbkmJBAzxDpC4xWfZwoit8o2+giicsYhQh9rGl+aHWxpQO86IsFPSpnWRrfQ+5b vsh1SiD2cjAOda/LGELBz/nUF0EMctp2CU3NxNhyy+TEv+muAXx/9E7MnPt1Ubo8RqaD 27r9KctNv9TtT01yco9bE7kNEKvqtxY670EhXPfQbRbYjg4MBYPLz62ri4/t4oGuQxSc r153vcpjTtdAY+FJmpdhOAxHaS4WbYWYKDe2y0+K7btm9xkZfV7bdihZuCVbQjRUgBR0 Yw2EcBju/IHktx+kl6OE3Ij09PTKXTqdbC0YuMWNOOSGIMm39vmazdnGof5fO03ABFSJ DC+A== 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=XynCFTEpJ9c9tpkSKwQRnpEBPBH5oxaR1GiqTnQE1Qk=; fh=F5i+rNW4hjf57QJHDx14Nq4Eso4Z4OyY/LhC2i40VT4=; b=uoPRkYYqD5zoQiOjwuAA0lnS0RyxjXVq/uIm0A/R3yjXYG4P8oqjWaqQTJjB6b0q5s 9HEhqtiiSPlXFmfp6VzYducPwBR0wPH/k32JnfyRWrt6FW5pFW5PxMmbzKDxzdvoXmQm oORqsLMb3JrCR8st/N4flcRhEZVkDjRwlWh1edJBCkDY2Hx8eqMwFz1oqvcmkRlPJQNR wMpe8XePjlLqCMpTTutM9K/cjLtBxeOIqVuAyyUxj1Az2ovvTV1x8mzslzmN048O/+ma qS6tdE4T1Nsav8g4uMK52MOL2q9JOFNHcIUVM8/G8OmdO+gN2FhaDf64rSOHrNAANIDo iRnQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=f+sxBKF1; 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-203257-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203257-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4a7425c0si140878756d6.186.2024.06.05.14.25.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 14:25:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203257-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=f+sxBKF1; 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-203257-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203257-linux.lists.archive=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 77F031C2379F for ; Wed, 5 Jun 2024 21:25:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F2C1169376; Wed, 5 Jun 2024 21:23:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="f+sxBKF1" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 5066715FA73; Wed, 5 Jun 2024 21:23:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717622618; cv=none; b=eWjwCwyUT+LUHLfWxbMgFFOsbddUZYMGHSk8CceqWrAQXQGP8+yJOdxpGWy5am7aOxPWjqXdL2uDpD4kZfZmmQICfNagrMc+NrXhUjjuMPEVjaA6upQyTUR2ZQSjUqFAl09m3Wgkeo79Brc6iI4j4HxQN0lD3e0ErnyDpBGJorM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717622618; c=relaxed/simple; bh=etJOxAM38wpvm42idu/GhLs1AJz+49tbiRt1itlzSAA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KWZwKpgwZyz5NQetm4F01Te75VRipSLb/zWnbnbxJr7vOkBpgZs48PG5+2z7bSCzIuW/38jZD3abnMwG0gJK0diNFDzCEPh7s29HAK9AHZu0aRavgXIxhtXa5FwiQ/Uz0TbiEAylOzMFyCXhgJO389d5yrmIGd0sZDYkAK+3BXQ= 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=f+sxBKF1; arc=none smtp.client-ip=148.163.156.1 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 (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 455LD0vZ012786; Wed, 5 Jun 2024 21:23:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc : content-transfer-encoding : date : from : in-reply-to : message-id : mime-version : references : subject : to; s=pp1; bh=XynCFTEpJ9c9tpkSKwQRnpEBPBH5oxaR1GiqTnQE1Qk=; b=f+sxBKF14ZiykpJdr8KVMARIJa96s4ptA+0ASQOvFHQooAy0aZ6P+ISa8Fj1XIyVd1dE QHvKS2lbkvn2ZOOvqC71MRw715xwbtRGyifoMZoYVRgoNbEdWaTei7jxfSUj6BEDVhYq UFEshQS8MI2m3C2h1Z13oH7kyOO9F8BG/KZD55jkrgIVb4fDLrUPVHj3MAP8hC4zKNda 57GTfIrlKbMhee/VyQ3NUJNuPUOTjyrQ8tdrd2UyZsJT12Drl2xWr4eo/mPB6qPWQOiR xqmy5CXTe08owp3Z8ATkt13K6kHpih+CvSe27H1/dubxzaEplUN0g8j61vDi5+8Hqx8R wA== 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 3yjyqf00re-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Jun 2024 21:23:20 +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 455JUEw5031114; Wed, 5 Jun 2024 21:23:19 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3ygeyppnt2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Jun 2024 21:23:19 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 455LNGaQ19923530 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Jun 2024 21:23:18 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2B7B358069; Wed, 5 Jun 2024 21:23:16 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E2BCE58066; Wed, 5 Jun 2024 21:23:15 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.121.242]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Jun 2024 21:23:15 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: eajames@linux.ibm.com, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-spi@vger.kernel.org, broonie@kernel.org, andi.shyti@kernel.org, joel@jms.id.au, alistair@popple.id.au, jk@ozlabs.org, andrew@codeconstruct.com.au, linux-aspeed@lists.ozlabs.org, ninad@linux.ibm.com, lakshmiy@us.ibm.com Subject: [PATCH v4 09/40] fsi: aspeed: Add AST2700 support Date: Wed, 5 Jun 2024 16:22:41 -0500 Message-Id: <20240605212312.349188-10-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240605212312.349188-1-eajames@linux.ibm.com> References: <20240605212312.349188-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 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: CMwTXUnHhq8T8B3lnqOzXQTyIJaOrBdC X-Proofpoint-ORIG-GUID: CMwTXUnHhq8T8B3lnqOzXQTyIJaOrBdC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-05_02,2024-06-05_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 mlxlogscore=999 impostorscore=0 adultscore=0 bulkscore=0 malwarescore=0 clxscore=1015 mlxscore=0 suspectscore=0 lowpriorityscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406050160 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 | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index f0a19cd451a07..3d15e867237df 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 */ @@ -81,6 +85,13 @@ static const u32 fsi_base = 0xa0000000; #define XFER_HALFWORD (BIT(0)) #define XFER_BYTE (0) +/* OPB_RETRY_COUNTER */ +#define OPB_RC_FSI_OPB BIT(19) /* Access FSI space over OPB, not AHB (AST27xx+) */ +#define OPB_RC_CTRL_OPB BIT(18) /* Access controller over OPB, not AHB (AST27xx+) */ +#define OPB_RC_XFER_ACK_EN BIT(16) /* Enable OPBx xfer ack bit without mask */ +#define OPB_RC_COUNT GENMASK(15, 0) /* Number of retries */ +#define OPB_RC_DEFAULT 0x10 + #define CREATE_TRACE_POINTS #include @@ -536,6 +547,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_RC_DEFAULT; struct fsi_master_aspeed *aspeed; int rc, links, reg; __be32 raw; @@ -579,8 +592,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 +668,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_RC_DEFAULT, +}; + +static const struct fsi_master_aspeed_data fsi_master_ast2700_data = { + .opb_retry_counter = OPB_RC_FSI_OPB | OPB_RC_CTRL_OPB | OPB_RC_DEFAULT, +}; + 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); -- 2.39.3