{"id":1936150,"url":"http://patchwork.ozlabs.org/api/patches/1936150/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-aspeed/patch/20240516181907.3468796-38-eajames@linux.ibm.com/","project":{"id":57,"url":"http://patchwork.ozlabs.org/api/projects/57/?format=json","name":"Linux ASPEED SoC development","link_name":"linux-aspeed","list_id":"linux-aspeed.lists.ozlabs.org","list_email":"linux-aspeed@lists.ozlabs.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20240516181907.3468796-38-eajames@linux.ibm.com>","list_archive_url":null,"date":"2024-05-16T18:19:04","name":"[v3,37/40] fsi: core: Add different types of CFAM","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"2dd64b15393b96caf59dd7e26fbeee3b2cbf1483","submitter":{"id":74989,"url":"http://patchwork.ozlabs.org/api/people/74989/?format=json","name":"Eddie James","email":"eajames@linux.ibm.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-aspeed/patch/20240516181907.3468796-38-eajames@linux.ibm.com/mbox/","series":[{"id":407101,"url":"http://patchwork.ozlabs.org/api/series/407101/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-aspeed/list/?series=407101","date":"2024-05-16T18:18:31","name":"fsi: Add interrupt support","version":3,"mbox":"http://patchwork.ozlabs.org/series/407101/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/1936150/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/1936150/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-aspeed-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-aspeed@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","linux-aspeed@lists.ozlabs.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=jqZnWPmM;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=112.213.38.117; helo=lists.ozlabs.org;\n envelope-from=linux-aspeed-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=jqZnWPmM;\n\tdkim-atps=neutral","lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=linux.ibm.com","lists.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=jqZnWPmM;\n\tdkim-atps=neutral","lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com\n (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com;\n envelope-from=eajames@linux.ibm.com; receiver=lists.ozlabs.org)"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (secp384r1))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4VgJMF5W72z1yfq\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 May 2024 04:21:29 +1000 (AEST)","from boromir.ozlabs.org (localhost [IPv6:::1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4VgJMF3KZyz3cVj\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 May 2024 04:21:29 +1000 (AEST)","from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com\n [148.163.158.5])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4VgJK002GQz3fs3;\n\tFri, 17 May 2024 04:19:31 +1000 (AEST)","from pps.filterd (m0353722.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id\n 44GG714X003960;\n\tThu, 16 May 2024 18:19:22 GMT","from ppma23.wdc07v.mail.ibm.com\n (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93])\n\tby mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3y5g6jh6u9-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tThu, 16 May 2024 18:19:22 +0000","from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1])\n\tby ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id\n 44GHabl2005998;\n\tThu, 16 May 2024 18:19:21 GMT","from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69])\n\tby ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3y2mgmud3h-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tThu, 16 May 2024 18:19:21 +0000","from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com\n [10.241.53.104])\n\tby smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 44GIJI1G18678322\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n\tThu, 16 May 2024 18:19:21 GMT","from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 9F4D85806B;\n\tThu, 16 May 2024 18:19:18 +0000 (GMT)","from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 60A1C58069;\n\tThu, 16 May 2024 18:19:18 +0000 (GMT)","from slate16.aus.stglabs.ibm.com (unknown [9.61.107.19])\n\tby smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP;\n\tThu, 16 May 2024 18:19:18 +0000 (GMT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com;\n h=from : to : cc : subject\n : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding; s=pp1;\n bh=UaPvf6PO9NoXq8wwJQeNt9uuUYf2ak6wZVS6nw5xVWE=;\n b=jqZnWPmMUzAX42xPQS+NsysJQBmRY8X5XJ2bH7UXahVWqBdvdNf0Zgj5JjYIll8mzzrk\n 71EkJc1Bz6EJKQvNkfspR74stf9datRUk/VL4fHfuwFFnWkxqJMSHrUrTbO0rE2ub5/p\n 5L0X+gnQvBwiN3n7+NfznJmGaePCCbCWAswdXwL+ugUaI9I3vdvAa6fkS7NEVxgUNeZD\n 5SxQtdYVZLwdHkn3GMDu3icBJuatoO+kVVvbYnOWkZR7Otuk937GqdIG6MU4twqEXigj\n Nz48dR9vZM+40vkJNZ9lbOZRYDCiNKs+fmYS2w/Rf95nFabHNcSfgbw66jw5AXmUS4RA Uw==","From":"Eddie James <eajames@linux.ibm.com>","To":"linux-fsi@lists.ozlabs.org","Subject":"[PATCH v3 37/40] fsi: core: Add different types of CFAM","Date":"Thu, 16 May 2024 13:19:04 -0500","Message-Id":"<20240516181907.3468796-38-eajames@linux.ibm.com>","X-Mailer":"git-send-email 2.39.3","In-Reply-To":"<20240516181907.3468796-1-eajames@linux.ibm.com>","References":"<20240516181907.3468796-1-eajames@linux.ibm.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-TM-AS-GCONF":"00","X-Proofpoint-ORIG-GUID":"BvFygxNzDn5UiTwaxCXe-fb5nnUBLwAP","X-Proofpoint-GUID":"BvFygxNzDn5UiTwaxCXe-fb5nnUBLwAP","X-Proofpoint-Virus-Version":"vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26\n definitions=2024-05-16_07,2024-05-15_01,2023-05-22_02","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n priorityscore=1501\n bulkscore=0 lowpriorityscore=0 mlxlogscore=999 mlxscore=0 impostorscore=0\n spamscore=0 phishscore=0 suspectscore=0 clxscore=1015 adultscore=0\n malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1\n engine=8.12.0-2405010000 definitions=main-2405160132","X-BeenThere":"linux-aspeed@lists.ozlabs.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux ASPEED SoC development <linux-aspeed.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linux-aspeed>,\n <mailto:linux-aspeed-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linux-aspeed/>","List-Post":"<mailto:linux-aspeed@lists.ozlabs.org>","List-Help":"<mailto:linux-aspeed-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linux-aspeed>,\n <mailto:linux-aspeed-request@lists.ozlabs.org?subject=subscribe>","Cc":"andi.shyti@kernel.org, linux-aspeed@lists.ozlabs.org, jk@ozlabs.org,\n alistair@popple.id.au, linux-kernel@vger.kernel.org,\n linux-spi@vger.kernel.org, broonie@kernel.org, andrew@codeconstruct.com.au,\n linux-i2c@vger.kernel.org","Errors-To":"linux-aspeed-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org","Sender":"\"Linux-aspeed\"\n <linux-aspeed-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>"},"content":"Detect the CFAM type based on the chip id and set up the device\ntype based on the CFAM type.\n\nSigned-off-by: Eddie James <eajames@linux.ibm.com>\n---\n drivers/fsi/fsi-core.c | 84 +++++++++++++++++++++++++++++++++++++++++-\n 1 file changed, 83 insertions(+), 1 deletion(-)","diff":"diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c\nindex 3d2bedb3ad51b..2785812a7d4ad 100644\n--- a/drivers/fsi/fsi-core.c\n+++ b/drivers/fsi/fsi-core.c\n@@ -1028,6 +1028,37 @@ static struct attribute *cfam_attrs[] = {\n \n ATTRIBUTE_GROUPS(cfam);\n \n+static struct attribute *cfam_s_attrs[] = {\n+\t&dev_attr_send_echo_delays.attr,\n+\t&dev_attr_chip_id.attr,\n+\t&dev_attr_cfam_id.attr,\n+\t&dev_attr_send_term.attr,\n+\t&dev_attr_config_table.attr,\n+\t&dev_attr_smode.attr.attr,\n+\t&dev_attr_sdma.attr.attr,\n+\t&dev_attr_sisc.attr.attr,\n+\t&dev_attr_sism.attr.attr,\n+\t&dev_attr_siss.attr.attr,\n+\t&dev_attr_sstat.attr.attr,\n+\t&dev_attr_si1m.attr.attr,\n+\t&dev_attr_si1s.attr.attr,\n+\t&dev_attr_sic.attr.attr,\n+\t&dev_attr_si2m.attr.attr,\n+\t&dev_attr_si2s.attr.attr,\n+\t&dev_attr_scmdt.attr.attr,\n+\t&dev_attr_sdata.attr.attr,\n+\t&dev_attr_slastd.attr.attr,\n+\t&dev_attr_smbl.attr.attr,\n+\t&dev_attr_soml.attr.attr,\n+\t&dev_attr_snml.attr.attr,\n+\t&dev_attr_smbr.attr.attr,\n+\t&dev_attr_somr.attr.attr,\n+\t&dev_attr_snmr.attr.attr,\n+\tNULL,\n+};\n+\n+ATTRIBUTE_GROUPS(cfam_s);\n+\n static char *cfam_devnode(const struct device *dev, umode_t *mode,\n \t\t\t  kuid_t *uid, kgid_t *gid)\n {\n@@ -1046,6 +1077,57 @@ static const struct device_type cfam_type = {\n \t.groups = cfam_groups\n };\n \n+static char *cfam_ody_devnode(const struct device *dev, umode_t *mode, kuid_t *uid, kgid_t *gid)\n+{\n+\tconst struct fsi_slave *slave = to_fsi_slave(dev);\n+\n+#ifdef CONFIG_FSI_NEW_DEV_NODE\n+\treturn kasprintf(GFP_KERNEL, \"fsi/ody%d\", slave->cdev_idx);\n+#else\n+\treturn kasprintf(GFP_KERNEL, \"ody%d\", slave->cdev_idx);\n+#endif\n+}\n+\n+static const struct device_type cfam_ody_type = {\n+\t.name = \"ody\",\n+\t.devnode = cfam_ody_devnode\n+};\n+\n+static char *cfam_s_devnode(const struct device *dev, umode_t *mode, kuid_t *uid, kgid_t *gid)\n+{\n+\tconst struct fsi_slave *slave = to_fsi_slave(dev);\n+\n+#ifdef CONFIG_FSI_NEW_DEV_NODE\n+\treturn kasprintf(GFP_KERNEL, \"fsi/cfam-s%d\", slave->cdev_idx);\n+#else\n+\treturn kasprintf(GFP_KERNEL, \"cfam-s%d\", slave->cdev_idx);\n+#endif\n+}\n+\n+static const struct device_type cfam_s_type = {\n+\t.name = \"cfam-s\",\n+\t.devnode = cfam_s_devnode,\n+\t.groups = cfam_s_groups,\n+};\n+\n+const struct device_type *fsi_get_cfam_type(u32 id)\n+{\n+\tu32 major = (id & 0xf00) >> 8;\n+\tu32 minor = (id & 0xf0) >> 4;\n+\n+\tswitch (major) {\n+\tcase 0x9:\n+\t\treturn &cfam_s_type;\n+\tcase 0xc:\n+\t\tif (minor == 0)\n+\t\t\treturn &cfam_ody_type;\n+\t\tfallthrough;\n+\tcase 0xd:\n+\tdefault:\n+\t\treturn &cfam_type;\n+\t}\n+}\n+\n static char *fsi_cdev_devnode(const struct device *dev, umode_t *mode,\n \t\t\t      kuid_t *uid, kgid_t *gid)\n {\n@@ -1202,7 +1284,7 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)\n \n \tspin_lock_init(&slave->lock);\n \tdev_set_name(&slave->dev, \"slave@%02x:%02x\", link, id);\n-\tslave->dev.type = &cfam_type;\n+\tslave->dev.type = fsi_get_cfam_type(cfam_id);\n \tslave->dev.parent = &master->dev;\n \tslave->dev.of_node = fsi_slave_find_of_node(master, link, id);\n \tslave->dev.release = fsi_slave_release;\n","prefixes":["v3","37/40"]}