From patchwork Fri Nov 8 05:19:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 11234103 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DB3141390 for ; Fri, 8 Nov 2019 05:20:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9C9921D7E for ; Fri, 8 Nov 2019 05:20:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LuVmcRAn"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VqXvYCt3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9C9921D7E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wj8vh8GmSz30VLM8J+dtcS2imbZvEofOfzxPApq4ecw=; b=LuVmcRAnLN0XMZ QL8mpuOYQPeGi9Rg39SXyQBfdA39U5MTOqyPcBE9XSJ+DY9SCkJ+YUP70ezuI9l6w3etw64vyFZ5y pRWCqsYr/Vn3wEDaNAaPYM1HBsnlQ9CPnPLSRsFTcDblzkdhw24hZm7hI6wN+O5b1dBwUZH7K90nC zS1fJJUu2TqhJsF+7mj8jo+x1qm2jefuKTbaOfk2QrZMONReZfcQbFouHHO1+RFY6chucoBUqLu8r 5xsYmoiIUXxUId+gUE5iE2JSmWRk6KtSev7NlGoBy+Xr5LuJJOnLxmlgeP/p7weuhgOs/Sdeu3dyA 6hxOHFy0r3rpwInGJbxA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwgw-00032e-Vp; Fri, 08 Nov 2019 05:20:14 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwgn-00028p-H0 for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2019 05:20:07 +0000 Received: by mail-pl1-x642.google.com with SMTP id l4so3239751plt.13 for ; Thu, 07 Nov 2019 21:20:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yc0niyL+e0o1G++JHufjcorcLLXvUhYDXt59boslzgg=; b=VqXvYCt3yjpIemP9x5nAW9klS4OYDVtIurvAczrm8dcH4b8jG/vIFrq7HA1zhqdEn1 WMmjWTT2tVk9wuQjqUzpDZlm/M8CCbwrETRX7+w+0nUluHW3CNl2B/iGn3Ja6NnEbsXp kf8vL/FOvPYedRq62dRG9jVGyG7wieYlyIv4oBqusl9akmvh0RKK6TKcIeooBUcOob/I H7lb4QLWxAzI8BaclZ2jWIpDuwDKY52OplmZwGyNALIK1a6EBhRcfKBfeCy2IvL3Xpao amyUwRxPbHN4UXXl8WWQKP/7RN3AW2p44AoRbPCEUf0riQEEJjiWwtQlnYHOykFdN9c8 p44g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=yc0niyL+e0o1G++JHufjcorcLLXvUhYDXt59boslzgg=; b=c/LKTjuLkJ2FconOj+9AQS8N7PASKdoRi6vMCFaWqJ6GsGdxAhzlnd5BlOUMlyQnh/ 8naGGwrIirRpOpXGi9Pk8bruFRcq6OqOAumt6B/eAbiEV9FzCPEj7aS4ah+PhWWHNXk2 /q5ipTMxz88f0FgW/qFTCgTa9QHj7oD/CZHrOFj8DILEZ+Q9YTd28GUGJQ5FkLH5dxGK fA2qMn9EJl8hfNaG4Ra/Ck+5aAUnSPJJJCW2ZT+knDXLMd3O/V+1nB9NNX/kvoyjMd+Q LA6SbXhAn51dgPkz4VZcSxnw+31mTm8dmWFYGkq7uvP2zihvnnXWKXBhMHE/uudSq0iZ UFsA== X-Gm-Message-State: APjAAAV2HsejwQ+38cTF/1r2zmc2COyhP8hVr2JOAlO2Tb0Im3SFlzyb O40ccTO9RqIEKeCt2SxFUJU= X-Google-Smtp-Source: APXvYqxc7+DDnJiPlXxQJe9LqipaDRCwapIGhvHz7o6az10ji38/hskICugffhdh+/IZ6mIRKsHrrg== X-Received: by 2002:a17:90a:9741:: with SMTP id i1mr10898615pjw.41.1573190404659; Thu, 07 Nov 2019 21:20:04 -0800 (PST) Received: from voyager.ibm.com ([36.255.48.244]) by smtp.gmail.com with ESMTPSA id v19sm3798443pjr.14.2019.11.07.21.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 21:20:04 -0800 (PST) From: Joel Stanley To: Rob Herring , Greg KH , Jeremy Kerr Subject: [PATCH v2 01/11] fsi: Add fsi-master class Date: Fri, 8 Nov 2019 15:49:35 +1030 Message-Id: <20191108051945.7109-2-joel@jms.id.au> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20191108051945.7109-1-joel@jms.id.au> References: <20191108051945.7109-1-joel@jms.id.au> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191107_212005_624033_2EBCF7D3 X-CRM114-Status: GOOD ( 11.19 ) X-Spam-Score: 0.3 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:642 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (joel.stan[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Alistar Popple , Eddie James , linux-kernel@vger.kernel.org, Steven Rostedt , Ingo Molnar , linux-arm-kernel@lists.infradead.org, linux-fsi@lists.ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Jeremy Kerr This change adds a device class for FSI masters, allowing access under /sys/class/fsi-master/, and easier udev rules. Signed-off-by: Jeremy Kerr Signed-off-by: Joel Stanley Acked-by: Alistair Popple --- drivers/fsi/fsi-core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 1f76740f33b6..0861f6097b33 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -1241,6 +1241,10 @@ static ssize_t master_break_store(struct device *dev, static DEVICE_ATTR(break, 0200, NULL, master_break_store); +struct class fsi_master_class = { + .name = "fsi-master", +}; + int fsi_master_register(struct fsi_master *master) { int rc; @@ -1249,6 +1253,7 @@ int fsi_master_register(struct fsi_master *master) mutex_init(&master->scan_lock); master->idx = ida_simple_get(&master_ida, 0, INT_MAX, GFP_KERNEL); dev_set_name(&master->dev, "fsi%d", master->idx); + master->dev.class = &fsi_master_class; rc = device_register(&master->dev); if (rc) { @@ -1350,8 +1355,15 @@ static int __init fsi_init(void) rc = bus_register(&fsi_bus_type); if (rc) goto fail_bus; + + rc = class_register(&fsi_master_class); + if (rc) + goto fail_class; + return 0; + fail_class: + bus_unregister(&fsi_bus_type); fail_bus: unregister_chrdev_region(fsi_base_dev, FSI_CHAR_MAX_DEVICES); return rc; @@ -1360,6 +1372,7 @@ postcore_initcall(fsi_init); static void fsi_exit(void) { + class_unregister(&fsi_master_class); bus_unregister(&fsi_bus_type); unregister_chrdev_region(fsi_base_dev, FSI_CHAR_MAX_DEVICES); ida_destroy(&fsi_minor_ida); From patchwork Fri Nov 8 05:19:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 11234105 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D11415AB for ; Fri, 8 Nov 2019 05:20:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A60F214DB for ; Fri, 8 Nov 2019 05:20:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tDVoJqwV"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="F4Uy3yD+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A60F214DB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4dT0RsWu5ng3ylKVn4tmPyVFZkR/rFYRBaqP4dd0UHY=; b=tDVoJqwVxkbmJ2 a385OtodAvK63AqDf95NBQUrp9FYN/vmo8xALZPrszE0G55igHZ/R2sK1B4zxcTAz5hr3bmrGKh4n 1xu5lXyljbEBxuadAV5nvBL7E/CkWbSc3S/cvXGbJi8qwC6/THx408V5YqZC3Zxw3GvEG16/+T5VW SH5/sSL5nMI7P+vQKF8ONfdonST7CqN+K9PDO5cZXiUYB9TzZC09aFBhxu/uI3sNf6HsgXUnY5xzm fc6ORWFhXrzOR85Mis5FcqxN0Pjji25RtfNxz8IYnVM1DrllNFaPglwdy2feRzSmJUmDpwS/PrXvs jn/8tMHVx7W9uTWwiGYA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwhI-0003OT-Ki; Fri, 08 Nov 2019 05:20:36 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwgu-0002m0-1q for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2019 05:20:13 +0000 Received: by mail-pl1-x642.google.com with SMTP id k7so3285716pll.1 for ; Thu, 07 Nov 2019 21:20:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VminkHZjPJEfcePoxrblVvTvuZD1weWd1AQS3sguLYY=; b=F4Uy3yD+3BM4e+yIRyLCZ6rTAtOy0OQPlCK/2TUXc4gKNGRYxG2Mt1jMMXy4po+n0s 4hkPi1wqrR3vk8JWcA9cWgkd7Wmsv2NzhYyKsbAYQeUzbDVoqA5gloJY9E+R/tT5PSSc GeZzJmm4sfUzbDZcexDaZsru6xBlLuZPo7T16Z06TRBKx3mhnbjoROjGxkfvj6NWqZO3 hqIDpRJEQMO8cGXgVWL95wU9Ow3Gfr9ZGtzeT/rdTNAfpYd58csKrfjWoITfQYxABx9l SqhYsoIJ9V0JURmQdQGQXRm8mjpQ1XVR2JYFONopnXHaHECrnSKBgvQulzJnF8CcHSeW 84bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=VminkHZjPJEfcePoxrblVvTvuZD1weWd1AQS3sguLYY=; b=aecmS4W8scVnRyAO03e52TMuQPfhuHgnaaqJxCDPElabdJKLfiy7clGXBqbVeYaXRr S9czgQxFOKLLaDdJQ1HUT5sfyE254qKVssomMNgbC6QhwCyd8gUWktv1ZT8LkfCuvQmV fdNcN08x9xLElEDGg5DTBxLe8BJPmWQFkQIs2gsvAQRGL8u/osMC7yLashmh0G6a3fUC wuJhrO+9s7zssRxe1yE1xSNFeHcJHsqj5Qfmi1KV21l0krG/PCplpo5M9OYRwA9LNV/Q B3PgJhSDhKXC5t8sKZ+pVb01yvn2wAltPXfrn+aJvIyQxBGz9dI57ZOX1hhb3LmkAXEQ z10Q== X-Gm-Message-State: APjAAAX3v+Q1zP1ojrtJhpGl2A7hUB2TFbwYV5E1Gdz0hlaHxMECO5r9 x4xYh4bjxjTUQUacRV1x18A= X-Google-Smtp-Source: APXvYqzk0ra5T3owJQ1Q9jaItHfMMjYMbyQPOGakYEt8GcLGEu417ZLj3vsIs20HPLE54o4W8y49+Q== X-Received: by 2002:a17:90a:c68f:: with SMTP id n15mr3170444pjt.20.1573190409931; Thu, 07 Nov 2019 21:20:09 -0800 (PST) Received: from voyager.ibm.com ([36.255.48.244]) by smtp.gmail.com with ESMTPSA id v19sm3798443pjr.14.2019.11.07.21.20.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 21:20:09 -0800 (PST) From: Joel Stanley To: Rob Herring , Greg KH , Jeremy Kerr Subject: [PATCH v2 02/11] fsi: Move master attributes to fsi-master class Date: Fri, 8 Nov 2019 15:49:36 +1030 Message-Id: <20191108051945.7109-3-joel@jms.id.au> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20191108051945.7109-1-joel@jms.id.au> References: <20191108051945.7109-1-joel@jms.id.au> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191107_212012_206623_E0555B8A X-CRM114-Status: GOOD ( 12.05 ) X-Spam-Score: 0.3 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:642 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (joel.stan[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Alistar Popple , Eddie James , linux-kernel@vger.kernel.org, Steven Rostedt , Ingo Molnar , linux-arm-kernel@lists.infradead.org, linux-fsi@lists.ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Jeremy Kerr Populate fsi_master_class->dev_attrs with the existing attribute definitions, so we don't need to explicitly register. Signed-off-by: Jeremy Kerr Signed-off-by: Joel Stanley Acked-by: Alistair Popple --- drivers/fsi/fsi-core.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 0861f6097b33..c773c65a5058 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -1241,8 +1241,17 @@ static ssize_t master_break_store(struct device *dev, static DEVICE_ATTR(break, 0200, NULL, master_break_store); +static struct attribute *master_attrs[] = { + &dev_attr_break.attr, + &dev_attr_rescan.attr, + NULL +}; + +ATTRIBUTE_GROUPS(master); + struct class fsi_master_class = { .name = "fsi-master", + .dev_groups = master_groups, }; int fsi_master_register(struct fsi_master *master) @@ -1261,20 +1270,6 @@ int fsi_master_register(struct fsi_master *master) return rc; } - rc = device_create_file(&master->dev, &dev_attr_rescan); - if (rc) { - device_del(&master->dev); - ida_simple_remove(&master_ida, master->idx); - return rc; - } - - rc = device_create_file(&master->dev, &dev_attr_break); - if (rc) { - device_del(&master->dev); - ida_simple_remove(&master_ida, master->idx); - return rc; - } - np = dev_of_node(&master->dev); if (!of_property_read_bool(np, "no-scan-on-init")) { mutex_lock(&master->scan_lock); From patchwork Fri Nov 8 05:19:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 11234107 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6AA5115AB for ; Fri, 8 Nov 2019 05:20:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3DEC5214DB for ; Fri, 8 Nov 2019 05:20:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nc6GQ0/Y"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="h/Htgv05" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3DEC5214DB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oMPCChZjAM/qJpYIj3odC5YgQDbMSOYy/+lwOmGACDE=; b=nc6GQ0/Y2fY1AD /lBKBFz4lKoqO7LQmJJqkNdYvy4nAssmTdYsmFZJzZtphry2ulYyyo1dahteKqtmGJ0/9P8iDJvMJ FwGzemYjcC9K8BitQ6mhXQhfzxq79pc8Miqfu/Myj3i+S7+4h08WFde3DpckFBccneV6kVeaxNDK1 XE2MhnfRctNjVc10FWtF+BIk1PL4/jBtC+bqobdgYfAHd89voJ11tCzZnSmZXx7vCBLsD2HMlF6LF 4ps9Bp1ggcKX1zJeTY3RrwJcvfuHFz/lq1abtiaH2bbiU97zPqvzmXjPHXhKhCF//I0OSucvb/0ht 9Ja4/MrwYJAFe5O8SbvQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwhZ-0003gj-2i; Fri, 08 Nov 2019 05:20:53 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwgy-00033h-3L for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2019 05:20:19 +0000 Received: by mail-pl1-x62f.google.com with SMTP id k7so3285855pll.1 for ; Thu, 07 Nov 2019 21:20:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YuW1ipLzZ/2+gNhmz9GQaaZr1Idsk5f88aGw6tJt1FE=; b=h/Htgv05sKRRazJUllEnoeg0JF9DrJfLx+QhhEnGCfV+4oK3XW71fEWR6xZFnu8rba 6l8xLBJWxW51VlEMz/bBR/OiaKWExGgNlNwSMPVRdc3z8I28eVuvr3RFE59DHmKQYBdr sTp4QRQN3orrHUh6AamiEiArid/lOOJqqdhi+a5G2i/o+iL851mAR7eWQVMQ8Yr6aYTb 9ep/S4IbA9aGJpML1MvscFH/stjhsyXwD9dCW+ad5s5+VOb9Pg5Gmamg5f9wkXNHaRK1 3Y7YYfDylifVoNKxvhBOG1r0ggRH0ccAI7Rx0ZTyx6N4PHc/dkabFgMdcCp8cjsXMfAH yuOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=YuW1ipLzZ/2+gNhmz9GQaaZr1Idsk5f88aGw6tJt1FE=; b=BAf+ujZJBwNbZdAbIuUVVHI9SjmG6R8IxdyqehIzlIw/7CUb0yf1l6XDRDfC1AdqXK 8q/266P/y3KfWW2CQx4oDP/Gfy8VxSHil0z+MBzkk0nJrWD8RJ3HS9627ViDLkROS+EU QRKoB7KQsa9a9nLBh6hY5iqRp3ydIFQYjRH1lethOtQFnNgIbs5yCyOYWPDmA1PLrKlC 8HXQKFU8d5Ud7nru5Hp+izWcWuqQlTd3gK+989rbEsveWw83qETHPdMXRpwJheTlSilz HujJCuhUxnp6LKtuPqArQA4rwUcvC4DR4korUKhsRElGAc1mV3PS7BSdo7e4RkSNjs31 xGmw== X-Gm-Message-State: APjAAAWQfU82cEdo56DyfJGmUDUfW9GK3l3PfdVjLMtx421uvtkIops6 e2J5AzL/qw0G8tjAPcF+LzQ= X-Google-Smtp-Source: APXvYqw3gu0p58jR3NALir+s/tOHFoe/Ibt9ItE1rMD3EBHbggifQSaQFtnZBgen2qwmkQOVnP1H1Q== X-Received: by 2002:a17:90a:24b:: with SMTP id t11mr10871279pje.77.1573190414746; Thu, 07 Nov 2019 21:20:14 -0800 (PST) Received: from voyager.ibm.com ([36.255.48.244]) by smtp.gmail.com with ESMTPSA id v19sm3798443pjr.14.2019.11.07.21.20.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 21:20:14 -0800 (PST) From: Joel Stanley To: Rob Herring , Greg KH , Jeremy Kerr Subject: [PATCH v2 03/11] ABI: Update FSI path documentation Date: Fri, 8 Nov 2019 15:49:37 +1030 Message-Id: <20191108051945.7109-4-joel@jms.id.au> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20191108051945.7109-1-joel@jms.id.au> References: <20191108051945.7109-1-joel@jms.id.au> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191107_212016_806137_B1DEAFF6 X-CRM114-Status: GOOD ( 10.00 ) X-Spam-Score: 0.3 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:62f listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (joel.stan[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Alistar Popple , Eddie James , linux-kernel@vger.kernel.org, Steven Rostedt , Ingo Molnar , linux-arm-kernel@lists.infradead.org, linux-fsi@lists.ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The paths added back in 4.13 weren't quite correct. The in reality the files documented lived under /sys/devices/../fsi0/rescan /sys/devices/../fsi0/break /sys/devices/../fsi0/slave@00:00/term /sys/devices/../fsi0/slave@00:00/raw In 5.5 with the addition of the FSI class they move to /sys/devices/../fsi-master/fsi0/rescan /sys/devices/../fsi-master/fsi0/break /sys/devices/../fsi-master/fsi0/slave@00:00/term /sys/devices/../fsi-master/fsi0/slave@00:00/raw This is closer to how the (incorrect) documentation described them. Signed-off-by: Joel Stanley Acked-by: Alistair Popple --- Documentation/ABI/testing/sysfs-bus-fsi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-fsi b/Documentation/ABI/testing/sysfs-bus-fsi index 57c806350d6c..320697bdf41d 100644 --- a/Documentation/ABI/testing/sysfs-bus-fsi +++ b/Documentation/ABI/testing/sysfs-bus-fsi @@ -1,25 +1,25 @@ -What: /sys/bus/platform/devices/fsi-master/rescan +What: /sys/bus/platform/devices/../fsi-master/fsi0/rescan Date: May 2017 KernelVersion: 4.12 -Contact: cbostic@linux.vnet.ibm.com +Contact: linux-fsi@lists.ozlabs.org Description: Initiates a FSI master scan for all connected slave devices on its links. -What: /sys/bus/platform/devices/fsi-master/break +What: /sys/bus/platform/devices/../fsi-master/fsi0/break Date: May 2017 KernelVersion: 4.12 -Contact: cbostic@linux.vnet.ibm.com +Contact: linux-fsi@lists.ozlabs.org Description: Sends an FSI BREAK command on a master's communication link to any connnected slaves. A BREAK resets connected device's logic and preps it to receive further commands from the master. -What: /sys/bus/platform/devices/fsi-master/slave@00:00/term +What: /sys/bus/platform/devices/../fsi-master/fsi0/slave@00:00/term Date: May 2017 KernelVersion: 4.12 -Contact: cbostic@linux.vnet.ibm.com +Contact: linux-fsi@lists.ozlabs.org Description: Sends an FSI terminate command from the master to its connected slave. A terminate resets the slave's state machines @@ -29,10 +29,10 @@ Description: ongoing operation in case of an expired 'Master Time Out' timer. -What: /sys/bus/platform/devices/fsi-master/slave@00:00/raw +What: /sys/bus/platform/devices/../fsi-master/fsi0/slave@00:00/raw Date: May 2017 KernelVersion: 4.12 -Contact: cbostic@linux.vnet.ibm.com +Contact: linux-fsi@lists.ozlabs.org Description: Provides a means of reading/writing a 32 bit value from/to a specified FSI bus address. From patchwork Fri Nov 8 05:19:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 11234109 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E593C1864 for ; Fri, 8 Nov 2019 05:21:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BAD80214DB for ; Fri, 8 Nov 2019 05:21:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Stqz00m4"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eLIcO37R" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BAD80214DB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vYxiMu7X5ITNk12qdz3ZCxK/hmJ4ItfJhXP5OY5OBJI=; b=Stqz00m4lcY9vQ /k+U/QhzO5tMoPiUIce/RFSjUMbu5O3p1R3FWqRl6gO/5D+vwbEYu+HUQg1fnEau4325hYOZYlYL0 hXU1eklblO44UbAYiOMCXK278RLwsJUtntWw6MJwWsTaqaGgRZODpKFoJ8DoFy9h0G1JgdcAVuYww SsUQGcbX4HgNSLNudiTr2vuzwT/08r+sbLcFJ6qV/Cy3G6wNQksUTq8TH2DFHeDT+mK3OvkxcDJaJ 6mLZO2EpxWUOpJX5xWf8gEeC5LrgnCZYnwjBag1glk95DWFEJ9at6apl27QvnSIOFJ/rG4UMaWP57 qHe3CMMJh+ta7cdoVGRQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwhp-0003yI-Mb; Fri, 08 Nov 2019 05:21:09 +0000 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwh4-00038I-0f for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2019 05:20:23 +0000 Received: by mail-pf1-x432.google.com with SMTP id c13so3883097pfp.5 for ; Thu, 07 Nov 2019 21:20:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TKTqUgLFNP8L+2pgyNr2mJwmi4tnNe/kzgV9Is+uXFk=; b=eLIcO37Rqryh80j1DWgiUO1Z8jSmPor+2XHv08XtdnCM3k7+Mcg5f/LNldagbqiqHA lAQrJ8fsazAYpu3uBzcNicGzxRD+X3JGypwI4L6/qnuRmZJI9LIiX5qOeFuvSnKk6Hpx iYNWiZaXn58tZQyPJEGwdF4bMZ2g1D8Cia0GdPkjqDqYaNOmp/fjjeUXFKLribS24uNA xC+XRLbJ/v9K2UUqRjdrAWVzJX5iQwWQrb1hoUOnosN5JuYSSB6Y2+wYwdgUiAie1T/6 nC5Yl+TZI0Nn38EVyYznPckjSaE0E48i5ffXeAGX9EojZowiiBUieDcGDyGO3sdryFFx M8sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=TKTqUgLFNP8L+2pgyNr2mJwmi4tnNe/kzgV9Is+uXFk=; b=YjWCbQbRD1Grvi824DrvoNrqL4e+oZc/4UJIzoXnWyG7XbapwwQGhVT4Eej50oK9Ku kifWeCbxbIWClX+MfwhxrkI1CdeHQ3dmR7B+YpZk78KHjlQwoCZujFpT0I51D/kh4elX UQJCBYjOVVcrLazO6wt1sOpkngBYUS9IRYPVQE1wecvlreYaH7aQPBmZaLPpD0g/I1+T 2phqA+kgYGqnRYI0cWfG0eQNr5zrmYBRbWOqxI2i43L/AVFT5fd3E9N4SM95RgRtv103 shekQ0wx38g75YNRik/8H3ZaiY0zBZSqUexI1C5dCO+faB545nyquDL42ejGkb1MPhz8 q7og== X-Gm-Message-State: APjAAAVZjIwalqack//atkg6f7AxbW49SiKy8Dc/BqqyN5ycA8SwA3Ij XMn4QffkFS+ljqVjvtZEKiM= X-Google-Smtp-Source: APXvYqzPNTY5lPCqO6tSNj4msuCp/WP/zKPnz+eK+7wPx5hWkEwRs4tQCrIf/zQmmVh8eefJ5bMtGQ== X-Received: by 2002:a63:dd51:: with SMTP id g17mr9325707pgj.388.1573190420080; Thu, 07 Nov 2019 21:20:20 -0800 (PST) Received: from voyager.ibm.com ([36.255.48.244]) by smtp.gmail.com with ESMTPSA id v19sm3798443pjr.14.2019.11.07.21.20.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 21:20:19 -0800 (PST) From: Joel Stanley To: Rob Herring , Greg KH , Jeremy Kerr Subject: [PATCH v2 04/11] trace: fsi: Print transfer size unsigned Date: Fri, 8 Nov 2019 15:49:38 +1030 Message-Id: <20191108051945.7109-5-joel@jms.id.au> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20191108051945.7109-1-joel@jms.id.au> References: <20191108051945.7109-1-joel@jms.id.au> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191107_212022_086342_2A9795B7 X-CRM114-Status: GOOD ( 10.40 ) X-Spam-Score: 0.3 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:432 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (joel.stan[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Andrew Jeffery , Alistar Popple , Eddie James , linux-kernel@vger.kernel.org, Steven Rostedt , Ingo Molnar , linux-arm-kernel@lists.infradead.org, linux-fsi@lists.ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Andrew Jeffery Due to other bugs I observed a spurious -1 transfer size. Signed-off-by: Andrew Jeffery Signed-off-by: Joel Stanley Acked-by: Alistair Popple --- include/trace/events/fsi.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/trace/events/fsi.h b/include/trace/events/fsi.h index 92e5e89e52ed..9832cb8e0eb0 100644 --- a/include/trace/events/fsi.h +++ b/include/trace/events/fsi.h @@ -26,7 +26,7 @@ TRACE_EVENT(fsi_master_read, __entry->addr = addr; __entry->size = size; ), - TP_printk("fsi%d:%02d:%02d %08x[%zd]", + TP_printk("fsi%d:%02d:%02d %08x[%zu]", __entry->master_idx, __entry->link, __entry->id, @@ -56,7 +56,7 @@ TRACE_EVENT(fsi_master_write, __entry->data = 0; memcpy(&__entry->data, data, size); ), - TP_printk("fsi%d:%02d:%02d %08x[%zd] <= {%*ph}", + TP_printk("fsi%d:%02d:%02d %08x[%zu] <= {%*ph}", __entry->master_idx, __entry->link, __entry->id, @@ -93,7 +93,7 @@ TRACE_EVENT(fsi_master_rw_result, if (__entry->write || !__entry->ret) memcpy(&__entry->data, data, size); ), - TP_printk("fsi%d:%02d:%02d %08x[%zd] %s {%*ph} ret %d", + TP_printk("fsi%d:%02d:%02d %08x[%zu] %s {%*ph} ret %d", __entry->master_idx, __entry->link, __entry->id, From patchwork Fri Nov 8 05:19:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 11234111 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 517DA15AB for ; Fri, 8 Nov 2019 05:21:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2709421882 for ; Fri, 8 Nov 2019 05:21:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LN4bwGfc"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XS4EhrtL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2709421882 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Y0ZFqUqgqEq8zbtDfol2/DjxYMf+wsl8kYWSlIYmKmw=; b=LN4bwGfcr8oFJv H1rqU/+kmXia4lgtI4BUqxeUk66dA7N5vltS4Bl/JLP5UCAvwRwHuD/HU5G1dMgNBbEM83HPRfuZT Mi8HF6FXURVe3HOAmrfGSR1FOdvojbNSLtf4qqwf3Zx3ixIyrFK5So9pkZfcENCj2oj38vgajwCZs XthbOvnFmK3PI4/QCrojgooVHCHeHkgDcCy3IbUQHY2VtjY40iq/BNsVakgeCARXTxTZYihYD8vi6 t1I2z2g4Icy6MGT/bV49QAti63yHtW5dxRyYW6G8BseXkrZarheGyqxj4hsNWVvNJNKK3V7Za6RIQ t+DmwR5/0QPam5912Fnw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwi6-0004Dh-1W; Fri, 08 Nov 2019 05:21:26 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwh8-0003E1-3a for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2019 05:20:27 +0000 Received: by mail-pf1-x444.google.com with SMTP id p24so3891328pfn.4 for ; Thu, 07 Nov 2019 21:20:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=abrU7G2BP5v8QeCE5OZCvci6QXqITkbp0Z5/JmfzQPA=; b=XS4EhrtLD7ira7yvelmd2Zy3twZdQh8w75/0Bvi5MIu/L4pOW3y8Uz4PCFCEcn0x2V UJRHR7EHVv4upN1s3mKOU+aXz8ou1jxdpweTYwgv4ZnBbnd7Ii4zfwrgAp55n2AvBJH3 1jhNhhQuZvooBbddpFbLmdVJs6jwPqfRAfvZpnzrHYf0XrHgX5EGpC7yIkL5+Us9WUFx BakG/iV27xw1PKS7f7ib3sHdPeWqSavpn0U224EvrUgbgOKPkXXEHgU5eVlcMk3CC16K aYQeJ7wbJ/sy2mgsQ4LVYZXgUfbtEZQm42iDbOBbjbnNadLsIbqADQtzfg1IwqX9IdC7 iKVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=abrU7G2BP5v8QeCE5OZCvci6QXqITkbp0Z5/JmfzQPA=; b=O/qh9pOU++vuy2/arikKr/pUmVJqf50RsPXj2d7xa8QlCes+ayHqQlyKrZiTyiyTdI QhzOgm9EXqsqw/fhTateXi5oyiUs3XuqO5/IOWRfKF61Za4d7+U3vaHqs5U1Nu6MM6+d 9UsqX0wyLrKrCeN6w5Nf/aZf7kzQpy6etcLqW5lXq+Vr1RmXD/UGiI09WcqltI0ICR5U 537aE7qgU3ly3JyxrUelGp0OwqWpayxzKQwgKMCc3zRyQjmHT8kBv3b7hbb/VCCOdPdj UDTwcLPACX31MNkwC0VG2uZDIupPyndljIIhaLg6S06pEdfluVKUTYOTFvywQjJfH8h4 tnIA== X-Gm-Message-State: APjAAAVnImcoaGvK8X8KJVumO8Ra5FHXGN4ydQBpRyc4m+ntbFJQIZ2Y 2qW9m5KF58l5eiLsifhoAYM= X-Google-Smtp-Source: APXvYqzuOVQPOmNdL1oWGOMyR40/RsnF24CKyjQWAw0vN7iQicHxialcfaga7srrNVEALqe7IjKKTQ== X-Received: by 2002:a63:495b:: with SMTP id y27mr9468935pgk.438.1573190425229; Thu, 07 Nov 2019 21:20:25 -0800 (PST) Received: from voyager.ibm.com ([36.255.48.244]) by smtp.gmail.com with ESMTPSA id v19sm3798443pjr.14.2019.11.07.21.20.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 21:20:24 -0800 (PST) From: Joel Stanley To: Rob Herring , Greg KH , Jeremy Kerr Subject: [PATCH v2 05/11] fsi: core: Fix small accesses and unaligned offsets via sysfs Date: Fri, 8 Nov 2019 15:49:39 +1030 Message-Id: <20191108051945.7109-6-joel@jms.id.au> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20191108051945.7109-1-joel@jms.id.au> References: <20191108051945.7109-1-joel@jms.id.au> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191107_212026_158832_6FA5BAB7 X-CRM114-Status: GOOD ( 15.21 ) X-Spam-Score: 0.3 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:444 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (joel.stan[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Andrew Jeffery , Alistar Popple , Eddie James , linux-kernel@vger.kernel.org, Steven Rostedt , Ingo Molnar , linux-arm-kernel@lists.infradead.org, linux-fsi@lists.ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Andrew Jeffery Subtracting the offset delta from four-byte alignment lead to wrapping of the requested length where `count` is less than `off`. Generalise the length handling to enable and optimise aligned access sizes for all offset and size combinations. The new formula produces the following results for given offset and count values: offset count | length --------------+------- 0 1 | 1 0 2 | 2 0 3 | 2 0 4 | 4 0 5 | 4 1 1 | 1 1 2 | 1 1 3 | 1 1 4 | 1 1 5 | 1 2 1 | 1 2 2 | 2 2 3 | 2 2 4 | 2 2 5 | 2 3 1 | 1 3 2 | 1 3 3 | 1 3 4 | 1 3 5 | 1 We might need something like this for the cfam chardevs as well, for example we don't currently implement any alignment restrictions / handling in the hardware master driver. Signed-off-by: Andrew Jeffery Signed-off-by: Joel Stanley --- drivers/fsi/fsi-core.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index c773c65a5058..e02ebcb0c9e6 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -544,6 +544,31 @@ static int fsi_slave_scan(struct fsi_slave *slave) return 0; } +static unsigned long aligned_access_size(size_t offset, size_t count) +{ + unsigned long offset_unit, count_unit; + + /* Criteria: + * + * 1. Access size must be less than or equal to the maximum access + * width or the highest power-of-two factor of offset + * 2. Access size must be less than or equal to the amount specified by + * count + * + * The access width is optimal if we can calculate 1 to be strictly + * equal while still satisfying 2. + */ + + /* Find 1 by the bottom bit of offset (with a 4 byte access cap) */ + offset_unit = BIT(__builtin_ctzl(offset | 4)); + + /* Find 2 by the top bit of count */ + count_unit = BIT(8 * sizeof(unsigned long) - 1 - __builtin_clzl(count)); + + /* Constrain the maximum access width to the minimum of both criteria */ + return BIT(__builtin_ctzl(offset_unit | count_unit)); +} + static ssize_t fsi_slave_sysfs_raw_read(struct file *file, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t off, size_t count) @@ -559,8 +584,7 @@ static ssize_t fsi_slave_sysfs_raw_read(struct file *file, return -EINVAL; for (total_len = 0; total_len < count; total_len += read_len) { - read_len = min_t(size_t, count, 4); - read_len -= off & 0x3; + read_len = aligned_access_size(off, count - total_len); rc = fsi_slave_read(slave, off, buf + total_len, read_len); if (rc) @@ -587,8 +611,7 @@ static ssize_t fsi_slave_sysfs_raw_write(struct file *file, return -EINVAL; for (total_len = 0; total_len < count; total_len += write_len) { - write_len = min_t(size_t, count, 4); - write_len -= off & 0x3; + write_len = aligned_access_size(off, count - total_len); rc = fsi_slave_write(slave, off, buf + total_len, write_len); if (rc) From patchwork Fri Nov 8 05:19:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 11234113 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7D90F15AB for ; Fri, 8 Nov 2019 05:21:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4828221882 for ; Fri, 8 Nov 2019 05:21:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="d0phbLKl"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OU9az6yy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4828221882 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9UuysSH9QjBGj8oTiISVYl5AOT07PCwtacbCB6OvHSQ=; b=d0phbLKl+65p0x K+14kYhvgkV11HJxb6VkklxzHU0niENcz863S8dFvcu/e+f5LRn2E04BpU62op7zWYwx9D7EH91pO pBYBHYS+zDxSwoJ1op3RT+JpHeSzTbXRHBvcfSH7B6QvIjarI4P/5k0evrJ7MsLuRPZdlDsu9G+i6 YfFl0fXM2Dgb3MgkFq1OfTaxRXXcCF8VdF/n1A6/jL1U6Ex078wS8/E1XdbHAmlyEYA8Xanh5HWVu i/Z4r2aThU8ofOl3UL5WgwMM3UbhFVzNLtyJmY5ilzfhSkxnOFz6OWnMpcDJk/1gpiUV22UehIRBa 7ZD8wfJtlOQzZgyqoNzg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwiG-0004QN-Jo; Fri, 08 Nov 2019 05:21:36 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwhD-0003Jh-It for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2019 05:20:33 +0000 Received: by mail-pl1-x641.google.com with SMTP id d7so1382574pls.3 for ; Thu, 07 Nov 2019 21:20:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IsgxuNQAHTHcIJrS856EvYwzkJI0BrRT1sF+4RZoSHY=; b=OU9az6yy3IUp3SiSu45yKUKtY2YuK45CZcO2G32kWBQjcf5VxlZGvBPTr5tLfyiIX7 SX+Y/CAJ6Lohdx8lZQe4N3YilX9GLn2S+d1xDzm0hZAk1CdbQg6PavJ3rw17DojAGuzU JPoCoAmi61dj7AkZEAyNdca0u9PUAqaZFXgTXOI9YdCqPg8h7/PwJizXrFHqgm3TTwG6 CLnz8oNQidGkSa83vKRcr9fDfsgEjcDAV9u1fpop4FVxcVnW3+MK1uuieMt9IEq2gzAb qqtL79/JudvPx+EgvVYIAzx5cHcVtft3C5d4MxtTSOhtPB2p1MFfEJp/wfqLgWBGvpQw Pp7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=IsgxuNQAHTHcIJrS856EvYwzkJI0BrRT1sF+4RZoSHY=; b=VtmAzmEPfToLA6TQgn3SNj2aaK3+kI4nh9jbPHS1ebCfL7g5PH2gHwCcXP5pLYWOSp +xgLjl81u3DDCHq650+DplNLF2RQ+P5JPz3SSOBAiuHGTn0W7cRpSAfyCKWDUqhd1t/d cF+G97ekix4KxkwTPSrHj6O2QocZ74l+w8ugLQF6qiTedkTIizP70W/O52YPac2UR1hN MMdxcSjtL39g1tj0wmAoqSbNrNolyqJiHDiP+BOId8/9gL6Pr4HQcSOLI9VY8L/Q1yA3 e6LoYRKeZFXw62zYPLwLjvhjEanysWWey65zRm4Bdi7Zu1NMRofeUNQZFAYr9xGUnt1h meKA== X-Gm-Message-State: APjAAAWcd/MK2o1gxa0cyhAXZMpe4fSpmnYUbnp9H+Zk9Gw6ZSx5yKxe 87NvjfE+trdDueKeex94ZNY= X-Google-Smtp-Source: APXvYqz3mckpSnE6ff65rlP5g6npFA0fhlUqDe6bSasd/PfFFnQhvBY+LCB6I6q0nqFNDzgJApwWvQ== X-Received: by 2002:a17:902:b604:: with SMTP id b4mr8201575pls.219.1573190430792; Thu, 07 Nov 2019 21:20:30 -0800 (PST) Received: from voyager.ibm.com ([36.255.48.244]) by smtp.gmail.com with ESMTPSA id v19sm3798443pjr.14.2019.11.07.21.20.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 21:20:29 -0800 (PST) From: Joel Stanley To: Rob Herring , Greg KH , Jeremy Kerr Subject: [PATCH v2 06/11] fsi: fsi_master_class can be static Date: Fri, 8 Nov 2019 15:49:40 +1030 Message-Id: <20191108051945.7109-7-joel@jms.id.au> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20191108051945.7109-1-joel@jms.id.au> References: <20191108051945.7109-1-joel@jms.id.au> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191107_212031_669624_F3591BDC X-CRM114-Status: GOOD ( 12.29 ) X-Spam-Score: 0.3 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (joel.stan[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, kbuild test robot , Alistar Popple , Eddie James , linux-kernel@vger.kernel.org, Steven Rostedt , Ingo Molnar , linux-arm-kernel@lists.infradead.org, linux-fsi@lists.ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: kbuild test robot There are no users outside of this file. Fixes: 0604d53d4da8 ("fsi: Add fsi-master class") Signed-off-by: kbuild test robot Signed-off-by: Joel Stanley --- drivers/fsi/fsi-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index e02ebcb0c9e6..8244da8a7241 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -1272,7 +1272,7 @@ static struct attribute *master_attrs[] = { ATTRIBUTE_GROUPS(master); -struct class fsi_master_class = { +static struct class fsi_master_class = { .name = "fsi-master", .dev_groups = master_groups, }; From patchwork Fri Nov 8 05:19:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 11234115 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A8B6D1390 for ; Fri, 8 Nov 2019 05:21:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 33B002075C for ; Fri, 8 Nov 2019 05:21:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qKNm93ON"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WJdy5MUY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33B002075C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=M9/0JpmqpKW3aXCofYgN2RKAmfY8c5nJvjn+6x3XKu8=; b=qKNm93ONFzIkAd i3ep/eUu+knuH+kQWu1xLRAwB9b6O+YgMVuZ7f5qAcQPMGu8s6LZyo10NrupwoTlvNHMa+/8zwyd3 1R5wRKZPJTfQMgkEenL6DQph8Z2o1PVdnOCvKAxJQ+ItVIY76Y5kenj8/ee1b+5/mktTaw2tnIj6+ tRCW10D+YFIG2b0IF7tz/+gSqazGBisRVXaDtl6lLy4fAcWav4L5AP4WlSFU5fmTtKoq+c7fugpKy hYtQKdrS1gPKiR0dLzuePM/Nb0e6uiCuuy0P2pV2btXDrkgKRkvirL8Fc4vlyVTfo6IRlWQx1ex0j i1mjawbX8yz8L9qBpZnw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwiX-0004k9-Dz; Fri, 08 Nov 2019 05:21:53 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwhJ-0003Pq-QF for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2019 05:20:39 +0000 Received: by mail-pl1-x643.google.com with SMTP id k7so3286575pll.1 for ; Thu, 07 Nov 2019 21:20:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hJrLEutB9IE4cH0o167QSbIRHowe1UGgC6cJgowDRoc=; b=WJdy5MUY1Qn6ddxA3VXbTCxIyHH/pCovQCmpMiGsm7aFyHIy6t5JxsMO5u7R4ZqdUg ASPNl9Htx31/fvHpIkQ8Wrk5YueUHpiKkqn5yxH2VSBaIaYeEbLsBX35sP/f6cYen0Gj BxiqVZVoq8SHoMB0f4AgMIooKXIdc2mX2V7aRF5T/dTecxbX09jc4GDFXP/3qXrN+Q6y DmGchBG33EVPLvwLM6YubzQs357dWd/hLNUg19/c06Xn0TlTfnV4KQE1tZawL3rbQ5xl ZHDn27LT4pu1DFXcDMEx3tWDIU2zl3H49jjiGVkDQf7TLCU5QF004qHs5kkSDmMtdCZN 9myA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=hJrLEutB9IE4cH0o167QSbIRHowe1UGgC6cJgowDRoc=; b=Zoe3uL5lv524waFlH1MwkDJBHqXbAKrwspNZLTL1e6aPpVnaOTXrzfODjH3F/HNXiz y/tQC7q233cX8kuo9SGvTtY4cM5SI1Pa/xa4YnCqbvBQ3hUxIJ9mW7d37oLrPVkYEbir FzNkVuZrYJJnajO+yjByZA07Xsqn72nOCpHUTkU6eZMNs3WiOgY9QQdchwwUssrzCX/k rgV/bJsnw/CBlJtwH+xwfMUTY1b9y3JUsLrQyHMlaXOIjbgu9hzIyLcj1Rjys5A/t4jy ChYsR7oDAH9UXDl6tyHsWafXqMygOhuXQbOt+xEljNvQMVAiWIhbjCcF8NmxXRUnzNo3 dgIg== X-Gm-Message-State: APjAAAWoKpdbFc2etWq1aOScdwvONkL6CW/qygIqHIX767wGRfwmElaC GqJgfRHxExfjBpAG8AzcUZw= X-Google-Smtp-Source: APXvYqyd3yOg4NaXOiiSFqpXKQuciExm5nky2I6MaamYJTkR7F+XGGCIOFvPLdiooYguNmRSf9Rl/A== X-Received: by 2002:a17:90a:17ad:: with SMTP id q42mr11067718pja.100.1573190436040; Thu, 07 Nov 2019 21:20:36 -0800 (PST) Received: from voyager.ibm.com ([36.255.48.244]) by smtp.gmail.com with ESMTPSA id v19sm3798443pjr.14.2019.11.07.21.20.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 21:20:35 -0800 (PST) From: Joel Stanley To: Rob Herring , Greg KH , Jeremy Kerr Subject: [PATCH v2 07/11] fsi: Move defines to common header Date: Fri, 8 Nov 2019 15:49:41 +1030 Message-Id: <20191108051945.7109-8-joel@jms.id.au> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20191108051945.7109-1-joel@jms.id.au> References: <20191108051945.7109-1-joel@jms.id.au> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191107_212037_897747_0DB6B896 X-CRM114-Status: GOOD ( 13.44 ) X-Spam-Score: 0.3 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:643 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (joel.stan[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Andrew Jeffery , Alistar Popple , Eddie James , linux-kernel@vger.kernel.org, Steven Rostedt , Ingo Molnar , linux-arm-kernel@lists.infradead.org, linux-fsi@lists.ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The FSI master registers are common to the hub and AST2600 master (and the FSP2, if someone was to upstream a driver for that). Add defines to the fsi-master.h header, and introduce headings to delineate the existing low level details. Acked-by: Andrew Jeffery Acked-by: Jeremy Kerr Signed-off-by: Joel Stanley --- drivers/fsi/fsi-master-hub.c | 46 ----------------------- drivers/fsi/fsi-master.h | 71 ++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 46 deletions(-) diff --git a/drivers/fsi/fsi-master-hub.c b/drivers/fsi/fsi-master-hub.c index f158b1a88286..def35cf92571 100644 --- a/drivers/fsi/fsi-master-hub.c +++ b/drivers/fsi/fsi-master-hub.c @@ -13,53 +13,7 @@ #include "fsi-master.h" -/* Control Registers */ -#define FSI_MMODE 0x0 /* R/W: mode */ -#define FSI_MDLYR 0x4 /* R/W: delay */ -#define FSI_MCRSP 0x8 /* R/W: clock rate */ -#define FSI_MENP0 0x10 /* R/W: enable */ -#define FSI_MLEVP0 0x18 /* R: plug detect */ -#define FSI_MSENP0 0x18 /* S: Set enable */ -#define FSI_MCENP0 0x20 /* C: Clear enable */ -#define FSI_MAEB 0x70 /* R: Error address */ -#define FSI_MVER 0x74 /* R: master version/type */ -#define FSI_MRESP0 0xd0 /* W: Port reset */ -#define FSI_MESRB0 0x1d0 /* R: Master error status */ -#define FSI_MRESB0 0x1d0 /* W: Reset bridge */ -#define FSI_MECTRL 0x2e0 /* W: Error control */ - -/* MMODE: Mode control */ -#define FSI_MMODE_EIP 0x80000000 /* Enable interrupt polling */ -#define FSI_MMODE_ECRC 0x40000000 /* Enable error recovery */ -#define FSI_MMODE_EPC 0x10000000 /* Enable parity checking */ -#define FSI_MMODE_P8_TO_LSB 0x00000010 /* Timeout value LSB */ - /* MSB=1, LSB=0 is 0.8 ms */ - /* MSB=0, LSB=1 is 0.9 ms */ -#define FSI_MMODE_CRS0SHFT 18 /* Clk rate selection 0 shift */ -#define FSI_MMODE_CRS0MASK 0x3ff /* Clk rate selection 0 mask */ -#define FSI_MMODE_CRS1SHFT 8 /* Clk rate selection 1 shift */ -#define FSI_MMODE_CRS1MASK 0x3ff /* Clk rate selection 1 mask */ - -/* MRESB: Reset brindge */ -#define FSI_MRESB_RST_GEN 0x80000000 /* General reset */ -#define FSI_MRESB_RST_ERR 0x40000000 /* Error Reset */ - -/* MRESB: Reset port */ -#define FSI_MRESP_RST_ALL_MASTER 0x20000000 /* Reset all FSI masters */ -#define FSI_MRESP_RST_ALL_LINK 0x10000000 /* Reset all FSI port contr. */ -#define FSI_MRESP_RST_MCR 0x08000000 /* Reset FSI master reg. */ -#define FSI_MRESP_RST_PYE 0x04000000 /* Reset FSI parity error */ -#define FSI_MRESP_RST_ALL 0xfc000000 /* Reset any error */ - -/* MECTRL: Error control */ -#define FSI_MECTRL_EOAE 0x8000 /* Enable machine check when */ - /* master 0 in error */ -#define FSI_MECTRL_P8_AUTO_TERM 0x4000 /* Auto terminate */ - #define FSI_ENGID_HUB_MASTER 0x1c -#define FSI_HUB_LINK_OFFSET 0x80000 -#define FSI_HUB_LINK_SIZE 0x80000 -#define FSI_HUB_MASTER_MAX_LINKS 8 #define FSI_LINK_ENABLE_SETUP_TIME 10 /* in mS */ diff --git a/drivers/fsi/fsi-master.h b/drivers/fsi/fsi-master.h index c7174237e864..6e8d4d4d5149 100644 --- a/drivers/fsi/fsi-master.h +++ b/drivers/fsi/fsi-master.h @@ -12,6 +12,71 @@ #include #include +/* + * Master registers + * + * These are used by hardware masters, such as the one in the FSP2, AST2600 and + * the hub master in POWER processors. + */ + +/* Control Registers */ +#define FSI_MMODE 0x0 /* R/W: mode */ +#define FSI_MDLYR 0x4 /* R/W: delay */ +#define FSI_MCRSP 0x8 /* R/W: clock rate */ +#define FSI_MENP0 0x10 /* R/W: enable */ +#define FSI_MLEVP0 0x18 /* R: plug detect */ +#define FSI_MSENP0 0x18 /* S: Set enable */ +#define FSI_MCENP0 0x20 /* C: Clear enable */ +#define FSI_MAEB 0x70 /* R: Error address */ +#define FSI_MVER 0x74 /* R: master version/type */ +#define FSI_MSTAP0 0xd0 /* R: Port status */ +#define FSI_MRESP0 0xd0 /* W: Port reset */ +#define FSI_MESRB0 0x1d0 /* R: Master error status */ +#define FSI_MRESB0 0x1d0 /* W: Reset bridge */ +#define FSI_MSCSB0 0x1d4 /* R: Master sub command stack */ +#define FSI_MATRB0 0x1d8 /* R: Master address trace */ +#define FSI_MDTRB0 0x1dc /* R: Master data trace */ +#define FSI_MECTRL 0x2e0 /* W: Error control */ + +/* MMODE: Mode control */ +#define FSI_MMODE_EIP 0x80000000 /* Enable interrupt polling */ +#define FSI_MMODE_ECRC 0x40000000 /* Enable error recovery */ +#define FSI_MMODE_RELA 0x20000000 /* Enable relative address commands */ +#define FSI_MMODE_EPC 0x10000000 /* Enable parity checking */ +#define FSI_MMODE_P8_TO_LSB 0x00000010 /* Timeout value LSB */ + /* MSB=1, LSB=0 is 0.8 ms */ + /* MSB=0, LSB=1 is 0.9 ms */ +#define FSI_MMODE_CRS0SHFT 18 /* Clk rate selection 0 shift */ +#define FSI_MMODE_CRS0MASK 0x3ff /* Clk rate selection 0 mask */ +#define FSI_MMODE_CRS1SHFT 8 /* Clk rate selection 1 shift */ +#define FSI_MMODE_CRS1MASK 0x3ff /* Clk rate selection 1 mask */ + +/* MRESB: Reset brindge */ +#define FSI_MRESB_RST_GEN 0x80000000 /* General reset */ +#define FSI_MRESB_RST_ERR 0x40000000 /* Error Reset */ + +/* MRESP: Reset port */ +#define FSI_MRESP_RST_ALL_MASTER 0x20000000 /* Reset all FSI masters */ +#define FSI_MRESP_RST_ALL_LINK 0x10000000 /* Reset all FSI port contr. */ +#define FSI_MRESP_RST_MCR 0x08000000 /* Reset FSI master reg. */ +#define FSI_MRESP_RST_PYE 0x04000000 /* Reset FSI parity error */ +#define FSI_MRESP_RST_ALL 0xfc000000 /* Reset any error */ + +/* MECTRL: Error control */ +#define FSI_MECTRL_EOAE 0x8000 /* Enable machine check when */ + /* master 0 in error */ +#define FSI_MECTRL_P8_AUTO_TERM 0x4000 /* Auto terminate */ + +#define FSI_HUB_LINK_OFFSET 0x80000 +#define FSI_HUB_LINK_SIZE 0x80000 +#define FSI_HUB_MASTER_MAX_LINKS 8 + +/* + * Protocol definitions + * + * These are used by low level masters that bit-bang out the protocol + */ + /* Various protocol delays */ #define FSI_ECHO_DELAY_CLOCKS 16 /* Number clocks for echo delay */ #define FSI_SEND_DELAY_CLOCKS 16 /* Number clocks for send delay */ @@ -47,6 +112,12 @@ /* fsi-master definition and flags */ #define FSI_MASTER_FLAG_SWCLOCK 0x1 +/* + * Structures and function prototypes + * + * These are common to all masters + */ + struct fsi_master { struct device dev; int idx; From patchwork Fri Nov 8 05:19:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 11234117 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E969315AB for ; Fri, 8 Nov 2019 05:22:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BB2682075C for ; Fri, 8 Nov 2019 05:22:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GShiRHCm"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DQV4QErw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB2682075C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=s7Yh+3I+du3s6mTJU+WwjeUyUkfxIQzqNC/AFRQuhRM=; b=GShiRHCmrjGZti 6kvAujuOcV/zj3S1c6YN+b8v3k8MnmRBPw7zH+P6F14U9vcNV56y0qUiq1wits8sbeil2JSsmsTah IfjIuwbLJwE7AP9InMEYWSyiJc10ivz8R84Z7J/kRynkgVNQSIXWn7mfAQFNoNjN6il+DhRQzrO6K VQxU1LnOUTuudclhNWdbdZIbTMZpgJzq5MsUVf5g7uw58CjEPceBEyokPbZhfXqEHrPkZmOfSXcjO DdAI0PnDYoyNF8k6DPkG8rrpXUG64U/rjNb1lcPvnkBJBz4RHccmbVLL4SAUAowoOXRaiPbrOIsqQ 51hzsAsNiFOAavQwa0lQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwil-0004ze-NR; Fri, 08 Nov 2019 05:22:07 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwhR-0003Yk-L6 for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2019 05:20:47 +0000 Received: by mail-pl1-x632.google.com with SMTP id az9so2427191plb.11 for ; Thu, 07 Nov 2019 21:20:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iGEIDbYmVZa9xwEGk6m/vD8N0Ug2Lhly+4TWkAdqLek=; b=DQV4QErwJZi1nk+I+ExV4GgrAt+hvlcVydeGwaA7/epaVfYBs5u+HOBas9IumvCH3N JxSoAVsemwQmhL9lwpjUyMccGjyCWAW8DMxKTol2RUQoNpM2zOk91ztHOozH88yCXnyS nQiyemAGRfY5zntLTi69NaA4DiECMQuM9cq9WdGTiSpag2j2HasNUGlKW0w9R5revTGH wvMIlyXkvzCyDczcv3X6NokPLYkJj8lxtymgsnm77GRivHxrwy3Wi2/uWPUWCQ7ka4u6 P+8I074TJg0IbfKtoUmk7RQLoOBZytBQn4RkJywcfMiFBonHKqy1FHK7keHZCkf2uKMz SZTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=iGEIDbYmVZa9xwEGk6m/vD8N0Ug2Lhly+4TWkAdqLek=; b=lhwlg6BZYB6uZM7ru4yHqJQ8g6U9RI+FDliYtsPV3S1AOo4PiMNWZkQTHNP0ocK6rZ FM+TenwJ4Ja4gr9Kx4SFoT5vEeLoTmn/6wbalzn9psTCGuEBDacATawBwSGcaF/0JPdF +uusTb7SJulQun0/m6uMzMmITYpCesTPsNEwPIE0aWoZPTxReS93iyq/52aQ6TYerDEl onQOrxH/aJ8V8pnVySPP5OrlZwOAHuywkGrvklCnsIKUtTRDin8gwawuWsWyrsnMGu13 NHJ6DA/LcPu6fXPPVfEIgpbUQhsSTbm26wU5oMcJuqiOxPHrpbtFy2PdrjXZmJ0abkMC 33PA== X-Gm-Message-State: APjAAAWh4M1nVyRrd0B4JMNdmCcrfciJFwhODJ0VOLlJN85iuR9Zdxuj ZzMjQ2V3u+T5s1DQBV4jiw0= X-Google-Smtp-Source: APXvYqyJmTdzvKroBystEahMC17uFRguxhlGPq7x/hTDNn3eP4EFiK4iTnSCiGGTzjO5MGvvFRMNEg== X-Received: by 2002:a17:902:ba91:: with SMTP id k17mr8454858pls.100.1573190443329; Thu, 07 Nov 2019 21:20:43 -0800 (PST) Received: from voyager.ibm.com ([36.255.48.244]) by smtp.gmail.com with ESMTPSA id v19sm3798443pjr.14.2019.11.07.21.20.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 21:20:42 -0800 (PST) From: Joel Stanley To: Rob Herring , Greg KH , Jeremy Kerr Subject: [PATCH v2 08/11] dt-bindings: fsi: Add description of FSI master Date: Fri, 8 Nov 2019 15:49:42 +1030 Message-Id: <20191108051945.7109-9-joel@jms.id.au> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20191108051945.7109-1-joel@jms.id.au> References: <20191108051945.7109-1-joel@jms.id.au> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191107_212045_746571_1EC178BF X-CRM114-Status: GOOD ( 11.21 ) X-Spam-Score: 0.3 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:632 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (joel.stan[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Alistar Popple , Eddie James , linux-kernel@vger.kernel.org, Steven Rostedt , Ingo Molnar , linux-arm-kernel@lists.infradead.org, linux-fsi@lists.ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This describes the FSI master present in the AST2600. Signed-off-by: Joel Stanley Acked-by: Alistair Popple --- .../bindings/fsi/fsi-master-aspeed.txt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Documentation/devicetree/bindings/fsi/fsi-master-aspeed.txt diff --git a/Documentation/devicetree/bindings/fsi/fsi-master-aspeed.txt b/Documentation/devicetree/bindings/fsi/fsi-master-aspeed.txt new file mode 100644 index 000000000000..b758f91914f7 --- /dev/null +++ b/Documentation/devicetree/bindings/fsi/fsi-master-aspeed.txt @@ -0,0 +1,24 @@ +Device-tree bindings for AST2600 FSI master +------------------------------------------- + +The AST2600 contains two identical FSI masters. They share a clock and have a +separate interrupt line and output pins. + +Required properties: + - compatible: "aspeed,ast2600-fsi-master" + - reg: base address and length + - clocks: phandle and clock number + - interrupts: platform dependent interrupt description + - pinctrl-0: phandle to pinctrl node + - pinctrl-names: pinctrl state + +Examples: + + fsi-master { + 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>; + }; From patchwork Fri Nov 8 05:19:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 11234119 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1D72015AB for ; Fri, 8 Nov 2019 05:22:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C3699214DB for ; Fri, 8 Nov 2019 05:22:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="e/thzu4g"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aRwHnnd9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C3699214DB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LVAXpFLfl5RhInQsKUMvlRtVVSvUA1oP7c1aHjWWbU0=; b=e/thzu4gvOJ8KV ShIaYaIFPhZplTmV2te1H8RP1Q6Ii2YO8hdjMu1L1QwE5VIAwVLkJcS8SiClKVsDd96qcQG0FygtV 8z5f6GXMT38lGl5Ild5B8hr/FOtDvKkADwmYcUtN+e96Idb3IBzv8lP/e/Bkp/coUXz0qSA91urYM q+6QJWMN/sUpLLyz6H5K2TgfRMIBrb4vXi2eYpyw8x0FbQcg2EfMKPgirND72HWfOkpXQGhe7lk40 KbWSDgkxB/I/TX2ISQYcWmUtSKc7ZenpfapDIa06TVsN5FFmad93O1DGfYYRV3C77e+pSAiYrRuCp d3US/nPCD8NBe2FBvtNg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwj7-0005Jm-76; Fri, 08 Nov 2019 05:22:29 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwhV-0003dc-Kd for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2019 05:20:56 +0000 Received: by mail-pl1-x641.google.com with SMTP id d7so1383196pls.3 for ; Thu, 07 Nov 2019 21:20:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=75+GBsm3s/u8w6X4ShxUr5jXVzQl8E1Ldm8VDSkE0ok=; b=aRwHnnd9+o9vNBa90kdKBJ5woCmX7y7E1jRHJtYC1NZ8YE6nFGm48L1pZXuxzClkmF YVZ0nBgMu9g4wIZvjpvTyqev4ABDxMKThxtSkgPYVlJx0ei+cfm15xOMVh0451Q7M/5M LvzwCEc2ha9KyP18JOufPWlSpxoM0X9q4Gghmz1mqw/RkZb1qhxwbrkewWEcgv+eRzVp TyEwoGJRnpODDSMVlzoL6/MKK2Rfpx5gVgZhqGSmIh+uJj3rjz4Ms91BLUIA850pvmqM weUqauZ5OpopcankkksJHF2fNTNpN/ovE40bD/RUvJnwzIshPO4Z3ke/kkPDpQSWAIir 1NHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=75+GBsm3s/u8w6X4ShxUr5jXVzQl8E1Ldm8VDSkE0ok=; b=fAlRfbA3zNbN14mEulzYlkkePx+gCr3NwmWjsZMxdIzSaswsOI9XxbEXl6xCm9M7mG X7adCDpMR8RCyMCH3b6YiV0ZshrldQpwmQGtBn47knBnZYUL9QW9eedxLsw9wA38MS8u SAYvNTuUpLMwHA7taAcNi4bafFeHGsT4u72bnAwUC5UyfnUpkYF2RhNie8vrhc1UW291 yQRorcIXbqJ4ExJaCcfxYscCVyVfGhkaZjwEhRuJfZSVVJo8G7+LRYVl1RVUSi25TzCv /yEg/6IdJcwuwnxDCAfv6NDIEMvvz525kk3el8ypedhCMYvSMjvPV09eUy8KbthwcmHW DpaQ== X-Gm-Message-State: APjAAAV74/+HlNqN3Q0uqIFdjkQVjYqq4spBQeJ0afKNZmtq51cH1Sqm Vse27WioY+Tnbo2y+3JPG3E= X-Google-Smtp-Source: APXvYqxD8aYRbwO9nbVABXX7ZoNVvByHpgAbFkZ32j3uH3jFTH6Wu8eM3CLTgyrDtrm4pKtecEEJdg== X-Received: by 2002:a17:902:bb8f:: with SMTP id m15mr4846211pls.121.1573190448378; Thu, 07 Nov 2019 21:20:48 -0800 (PST) Received: from voyager.ibm.com ([36.255.48.244]) by smtp.gmail.com with ESMTPSA id v19sm3798443pjr.14.2019.11.07.21.20.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 21:20:47 -0800 (PST) From: Joel Stanley To: Rob Herring , Greg KH , Jeremy Kerr Subject: [PATCH v2 09/11] fsi: Add ast2600 master driver Date: Fri, 8 Nov 2019 15:49:43 +1030 Message-Id: <20191108051945.7109-10-joel@jms.id.au> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20191108051945.7109-1-joel@jms.id.au> References: <20191108051945.7109-1-joel@jms.id.au> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191107_212049_756065_031500E5 X-CRM114-Status: GOOD ( 20.00 ) X-Spam-Score: 0.3 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (joel.stan[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Alistar Popple , Eddie James , linux-kernel@vger.kernel.org, Steven Rostedt , Ingo Molnar , linux-arm-kernel@lists.infradead.org, linux-fsi@lists.ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The ast2600 BMC has a pair of FSI masters in it, behind an AHB to OPB bridge. The master driver supports reads and writes of full words, half word and byte accesses to remote CFAMs. It can perform very basic error recovery through resetting of the FSI port when an error is detected, and the issuing of breaks and terms. Signed-off-by: Joel Stanley Acked-by: Alistair Popple --- v2: - remove debugging - squash in fixes --- drivers/fsi/Kconfig | 8 + drivers/fsi/Makefile | 1 + drivers/fsi/fsi-master-aspeed.c | 522 ++++++++++++++++++++++++++++++++ 3 files changed, 531 insertions(+) create mode 100644 drivers/fsi/fsi-master-aspeed.c diff --git a/drivers/fsi/Kconfig b/drivers/fsi/Kconfig index c612db7a914a..92ce6d85802c 100644 --- a/drivers/fsi/Kconfig +++ b/drivers/fsi/Kconfig @@ -53,6 +53,14 @@ config FSI_MASTER_AST_CF lines driven by the internal ColdFire coprocessor. This requires the corresponding machine specific ColdFire firmware to be available. +config FSI_MASTER_ASPEED + tristate "FSI ASPEED master" + help + This option enables a FSI master that is present behind an OPB bridge + in the AST2600. + + Enable it for your BMC kernel in an OpenPower or IBM Power system. + config FSI_SCOM tristate "SCOM FSI client device driver" ---help--- diff --git a/drivers/fsi/Makefile b/drivers/fsi/Makefile index e4a2ff043c32..da218a1ad8e1 100644 --- a/drivers/fsi/Makefile +++ b/drivers/fsi/Makefile @@ -2,6 +2,7 @@ obj-$(CONFIG_FSI) += fsi-core.o obj-$(CONFIG_FSI_MASTER_HUB) += fsi-master-hub.o +obj-$(CONFIG_FSI_MASTER_ASPEED) += fsi-master-aspeed.o obj-$(CONFIG_FSI_MASTER_GPIO) += fsi-master-gpio.o obj-$(CONFIG_FSI_MASTER_AST_CF) += fsi-master-ast-cf.o obj-$(CONFIG_FSI_SCOM) += fsi-scom.o diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c new file mode 100644 index 000000000000..d1b83f035483 --- /dev/null +++ b/drivers/fsi/fsi-master-aspeed.c @@ -0,0 +1,522 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright (C) IBM Corporation 2018 +// FSI master driver for AST2600 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "fsi-master.h" + +struct fsi_master_aspeed { + struct fsi_master master; + struct device *dev; + void __iomem *base; + struct clk *clk; +}; + +#define to_fsi_master_aspeed(m) \ + container_of(m, struct fsi_master_aspeed, master) + +/* Control register (size 0x400) */ +static const u32 ctrl_base = 0x80000000; + +static const u32 fsi_base = 0xa0000000; + +#define OPB_FSI_VER 0x00 +#define OPB_TRIGGER 0x04 +#define OPB_CTRL_BASE 0x08 +#define OPB_FSI_BASE 0x0c +#define OPB_CLK_SYNC 0x3c +#define OPB_IRQ_CLEAR 0x40 +#define OPB_IRQ_MASK 0x44 +#define OPB_IRQ_STATUS 0x48 + +#define OPB0_SELECT 0x10 +#define OPB0_RW 0x14 +#define OPB0_XFER_SIZE 0x18 +#define OPB0_FSI_ADDR 0x1c +#define OPB0_FSI_DATA_W 0x20 +#define OPB0_STATUS 0x80 +#define OPB0_FSI_DATA_R 0x84 + +#define OPB0_WRITE_ORDER1 0x4c +#define OPB0_WRITE_ORDER2 0x50 +#define OPB1_WRITE_ORDER1 0x54 +#define OPB1_WRITE_ORDER2 0x58 +#define OPB0_READ_ORDER1 0x5c +#define OPB1_READ_ORDER2 0x60 + +#define OPB_RETRY_COUNTER 0x64 + +/* OPBn_STATUS */ +#define STATUS_HALFWORD_ACK BIT(0) +#define STATUS_FULLWORD_ACK BIT(1) +#define STATUS_ERR_ACK BIT(2) +#define STATUS_RETRY BIT(3) +#define STATUS_TIMEOUT BIT(4) + +/* OPB_IRQ_MASK */ +#define OPB1_XFER_ACK_EN BIT(17) +#define OPB0_XFER_ACK_EN BIT(16) + +/* OPB_RW */ +#define CMD_READ BIT(0) +#define CMD_WRITE 0 + +/* OPBx_XFER_SIZE */ +#define XFER_FULLWORD (BIT(1) | BIT(0)) +#define XFER_HALFWORD (BIT(0)) +#define XFER_BYTE (0) + +#define FSI_LINK_ENABLE_SETUP_TIME 10 /* in mS */ + +#define DEFAULT_DIVISOR 14 +#define OPB_POLL_TIMEOUT 10000 + +static int __opb_write(struct fsi_master_aspeed *aspeed, u32 addr, + u32 val, u32 transfer_size) +{ + void __iomem *base = aspeed->base; + u32 reg, status; + int ret; + + writel(CMD_WRITE, base + OPB0_RW); + writel(transfer_size, base + OPB0_XFER_SIZE); + writel(addr, base + OPB0_FSI_ADDR); + writel(val, base + OPB0_FSI_DATA_W); + writel(0x1, base + OPB_IRQ_CLEAR); + writel(0x1, base + OPB_TRIGGER); + + ret = readl_poll_timeout(base + OPB_IRQ_STATUS, reg, + (reg & OPB0_XFER_ACK_EN) != 0, + 0, OPB_POLL_TIMEOUT); + + status = readl(base + OPB0_STATUS); + + /* Return error when poll timed out */ + if (ret) + return ret; + + /* Command failed, master will reset */ + if (status & STATUS_ERR_ACK) + return -EIO; + + return 0; +} + +static int opb_writeb(struct fsi_master_aspeed *aspeed, u32 addr, u8 val) +{ + return __opb_write(aspeed, addr, val, XFER_BYTE); +} + +static int opb_writew(struct fsi_master_aspeed *aspeed, u32 addr, __be16 val) +{ + return __opb_write(aspeed, addr, (__force u16)val, XFER_HALFWORD); +} + +static int opb_writel(struct fsi_master_aspeed *aspeed, u32 addr, __be32 val) +{ + return __opb_write(aspeed, addr, (__force u32)val, XFER_FULLWORD); +} + +static int __opb_read(struct fsi_master_aspeed *aspeed, uint32_t addr, + u32 transfer_size, void *out) +{ + void __iomem *base = aspeed->base; + u32 result, reg; + int status, ret; + + writel(CMD_READ, base + OPB0_RW); + writel(transfer_size, base + OPB0_XFER_SIZE); + writel(addr, base + OPB0_FSI_ADDR); + writel(0x1, base + OPB_IRQ_CLEAR); + writel(0x1, base + OPB_TRIGGER); + + ret = readl_poll_timeout(base + OPB_IRQ_STATUS, reg, + (reg & OPB0_XFER_ACK_EN) != 0, + 0, OPB_POLL_TIMEOUT); + + status = readl(base + OPB0_STATUS); + + result = readl(base + OPB0_FSI_DATA_R); + + /* Return error when poll timed out */ + if (ret) + return ret; + + /* Command failed, master will reset */ + 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; + } + + } + + return 0; +} + +static int opb_readl(struct fsi_master_aspeed *aspeed, uint32_t addr, __be32 *out) +{ + return __opb_read(aspeed, addr, XFER_FULLWORD, out); +} + +static int opb_readw(struct fsi_master_aspeed *aspeed, uint32_t addr, __be16 *out) +{ + return __opb_read(aspeed, addr, XFER_HALFWORD, (void *)out); +} + +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) +{ + struct fsi_master_aspeed *aspeed = to_fsi_master_aspeed(master); + int ret; + + if (id != 0) + return -EINVAL; + + addr += link * FSI_HUB_LINK_SIZE; + + switch (size) { + case 1: + ret = opb_readb(aspeed, fsi_base + addr, val); + break; + case 2: + ret = opb_readw(aspeed, fsi_base + addr, val); + break; + case 4: + ret = opb_readl(aspeed, fsi_base + addr, val); + break; + default: + return -EINVAL; + } + + ret = check_errors(aspeed, ret); + if (ret) + return ret; + + return 0; +} + +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); + int ret; + + if (id != 0) + return -EINVAL; + + addr += link * FSI_HUB_LINK_SIZE; + + switch (size) { + case 1: + ret = opb_writeb(aspeed, fsi_base + addr, *(u8 *)val); + break; + case 2: + ret = opb_writew(aspeed, fsi_base + addr, *(__be16 *)val); + break; + case 4: + ret = opb_writel(aspeed, fsi_base + addr, *(__be32 *)val); + break; + default: + return -EINVAL; + } + + ret = check_errors(aspeed, ret); + if (ret) + return ret; + + return 0; +} + +static int aspeed_master_link_enable(struct fsi_master *master, int link) +{ + struct fsi_master_aspeed *aspeed = to_fsi_master_aspeed(master); + int idx, bit, ret; + __be32 reg, result; + + idx = link / 32; + bit = link % 32; + + reg = cpu_to_be32(0x80000000 >> bit); + + ret = opb_writel(aspeed, ctrl_base + FSI_MSENP0 + (4 * idx), reg); + if (ret) + return ret; + + mdelay(FSI_LINK_ENABLE_SETUP_TIME); + + ret = opb_readl(aspeed, ctrl_base + FSI_MENP0 + (4 * idx), &result); + if (ret) + return ret; + + if (result != reg) { + dev_err(aspeed->dev, "%s failed: %08x\n", __func__, result); + return -EIO; + } + + return 0; +} + +static int aspeed_master_term(struct fsi_master *master, int link, uint8_t id) +{ + uint32_t addr; + __be32 cmd; + + addr = 0x4; + cmd = cpu_to_be32(0xecc00000); + + return aspeed_master_write(master, link, id, addr, &cmd, 4); +} + +static int aspeed_master_break(struct fsi_master *master, int link) +{ + uint32_t addr; + __be32 cmd; + + addr = 0x0; + cmd = cpu_to_be32(0xc0de0000); + + return aspeed_master_write(master, link, 0, addr, &cmd, 4); +} + +static void aspeed_master_release(struct device *dev) +{ + struct fsi_master_aspeed *aspeed = + to_fsi_master_aspeed(dev_to_fsi_master(dev)); + + kfree(aspeed); +} + +/* 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 aspeed_master_init(struct fsi_master_aspeed *aspeed) +{ + __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(DEFAULT_DIVISOR) + | fsi_mmode_crs1(DEFAULT_DIVISOR) + | FSI_MMODE_P8_TO_LSB); + 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; +} + +static int fsi_master_aspeed_probe(struct platform_device *pdev) +{ + struct fsi_master_aspeed *aspeed; + struct resource *res; + int rc, links, reg; + __be32 raw; + + aspeed = devm_kzalloc(&pdev->dev, sizeof(*aspeed), GFP_KERNEL); + if (!aspeed) + return -ENOMEM; + + aspeed->dev = &pdev->dev; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + aspeed->base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(aspeed->base)) + return PTR_ERR(aspeed->base); + + aspeed->clk = devm_clk_get(aspeed->dev, NULL); + if (IS_ERR(aspeed->clk)) { + dev_err(aspeed->dev, "couldn't get clock\n"); + return PTR_ERR(aspeed->clk); + } + rc = clk_prepare_enable(aspeed->clk); + if (rc) { + dev_err(aspeed->dev, "couldn't enable clock\n"); + return rc; + } + + writel(0x1, aspeed->base + OPB_CLK_SYNC); + 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(ctrl_base, aspeed->base + OPB_CTRL_BASE); + writel(fsi_base, aspeed->base + OPB_FSI_BASE); + + /* Set read data order */ + writel(0x0011bb1b, aspeed->base + OPB0_READ_ORDER1); + + /* Set write data order */ + writel(0x0011bb1b, aspeed->base + OPB0_WRITE_ORDER1); + writel(0xffaa5500, aspeed->base + OPB0_WRITE_ORDER2); + + /* + * Select OPB0 for all operations. + * Will need to be reworked when enabling DMA or anything that uses + * OPB1. + */ + writel(0x1, aspeed->base + OPB0_SELECT); + + rc = opb_readl(aspeed, ctrl_base + FSI_MVER, &raw); + if (rc) { + dev_err(&pdev->dev, "failed to read hub version\n"); + return rc; + } + + reg = be32_to_cpu(raw); + links = (reg >> 8) & 0xff; + dev_info(&pdev->dev, "hub version %08x (%d links)\n", reg, links); + + aspeed->master.dev.parent = &pdev->dev; + aspeed->master.dev.release = aspeed_master_release; + aspeed->master.dev.of_node = of_node_get(dev_of_node(&pdev->dev)); + + aspeed->master.n_links = links; + 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); + + aspeed_master_init(aspeed); + + rc = fsi_master_register(&aspeed->master); + if (rc) + goto err_release; + + /* At this point, fsi_master_register performs the device_initialize(), + * and holds the sole reference on master.dev. This means the device + * will be freed (via ->release) during any subsequent call to + * fsi_master_unregister. We add our own reference to it here, so we + * can perform cleanup (in _remove()) without it being freed before + * we're ready. + */ + get_device(&aspeed->master.dev); + return 0; + +err_release: + clk_disable_unprepare(aspeed->clk); + return rc; +} + +static int fsi_master_aspeed_remove(struct platform_device *pdev) +{ + struct fsi_master_aspeed *aspeed = platform_get_drvdata(pdev); + + fsi_master_unregister(&aspeed->master); + clk_disable_unprepare(aspeed->clk); + + return 0; +} + +static const struct of_device_id fsi_master_aspeed_match[] = { + { .compatible = "aspeed,ast2600-fsi-master" }, + { }, +}; + +static struct platform_driver fsi_master_aspeed_driver = { + .driver = { + .name = "fsi-master-aspeed", + .of_match_table = fsi_master_aspeed_match, + }, + .probe = fsi_master_aspeed_probe, + .remove = fsi_master_aspeed_remove, +}; + +module_platform_driver(fsi_master_aspeed_driver); +MODULE_LICENSE("GPL"); From patchwork Fri Nov 8 05:19:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 11234121 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DED311390 for ; Fri, 8 Nov 2019 05:22:47 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A72EF214DB for ; Fri, 8 Nov 2019 05:22:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DhokJIIB"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MhlJ0TKo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A72EF214DB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=X0E8zfZska+hpZeSMliS5LQwp+sOfBHjzWfuCgxHL4Y=; b=DhokJIIBbLYoCK Xsc0WCf4hEDLy00RUgxCslW8BsvxY62++mmfyWGKuqVRWdIxGeX2/15roTq+Hwf+OnnBnFZq60roN Azs1EmVJHQjI/vRLh6TLg7oUUCwD9H++0EtY5zgi8IUQlS/FY/I9exx0kT2tUga704Si32ikTGZUE 2YeSp4jbqLxrXMgKYmsAUUHRaJo2dedd6bfzKUAwP/1LsLouI+bkseMjOpypQoHH3k3tZqTPyKe5N 8VDscZnuokrrpWJRfT5AeVhWRHVtHEvH7hYmLBl5NRU+rpUdvgTRuF9+SEhXrep2vAQ/yw3fYFcdh DNBCpUpkG5h1iGQZZkeA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwjL-0005ZC-PT; Fri, 08 Nov 2019 05:22:43 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwhb-0003ib-By for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2019 05:20:57 +0000 Received: by mail-pl1-x641.google.com with SMTP id s10so3287194plp.2 for ; Thu, 07 Nov 2019 21:20:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BrSCYYt5uv3Xj+d3we2tNppwdrCJ/ZJWLFSrmqcGBRo=; b=MhlJ0TKo/+JKtKDsOMJfCvSVaU7SRAI/53zvs21Uxpqd2fVltgOmhUw2wGVXjJrnf4 XKChYSHwHr+2kYqjTLmrV2R7V7wvvKZ82xO2FPQUX/lWOj0PEjHJ+l0h0aKSNCVK2NSM JnShWoTenORutECEwhFeICjZPtHyKCEhNYuIavPPlGvLOoJFPDcupN4gzFccVChzYtdN f9dujcWhBvfV47wkYdlnoVYkhF0XoAaqKTtduVudVSLVSqb/SE2skJhfOLEybAub/SYT HewfHo12V3FZo/niFBwJ3Qc9IBaq5lvoIoA2DljwZ8UyF3mgEpLx61nJMdFpjmaivl4A Htog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=BrSCYYt5uv3Xj+d3we2tNppwdrCJ/ZJWLFSrmqcGBRo=; b=kO9pOByYa3iVPUokqSAo1/mIZAZOuxMR/5Wkid2OxeH2Bd28LoEs1nnmosWxhTV9HX KtCg/9C6UOPQCJUqpN9QUtFPuS4x6R1RCK6ove2VKX5IEYFGcVnFP1D8gRUNiD/hpXO/ s1PFDoHNceBsgCV8krSWRRHN5ez3GtmZxerapzzQ8sFy/lU2TSFPZ/2Qv3N49FPUh+M5 TMW6+tjKT98ybK8L6xiGZqiQniZFM0mZoWMa/SWaxQf45n3mIKJqH6mAMhJZiKmP/eUj D6x+rKE1jxZgT4LnNgS3jFoSTAtp0HVWWWXzbY6C8YhB0cz7j1ozKMiGnyYoqi34gWH+ +6ww== X-Gm-Message-State: APjAAAVGSeFLSlRudR5nNTHm3eLgdIq5zn2TjVnrK+ZRdx6z0Z3EzsiZ xOrnvRtdqIcm38aetezy09XyQ8tW+bfbcQ== X-Google-Smtp-Source: APXvYqyRzZcn8bDT1qTq02KNEt9UXS/4vlqBy54qzIiyqsiCXJfHND9OOB71hNviccEf9bdv8fJSAw== X-Received: by 2002:a17:902:a987:: with SMTP id bh7mr8100812plb.181.1573190453257; Thu, 07 Nov 2019 21:20:53 -0800 (PST) Received: from voyager.ibm.com ([36.255.48.244]) by smtp.gmail.com with ESMTPSA id v19sm3798443pjr.14.2019.11.07.21.20.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 21:20:52 -0800 (PST) From: Joel Stanley To: Rob Herring , Greg KH , Jeremy Kerr Subject: [PATCH v2 10/11] fsi: aspeed: Add trace points Date: Fri, 8 Nov 2019 15:49:44 +1030 Message-Id: <20191108051945.7109-11-joel@jms.id.au> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20191108051945.7109-1-joel@jms.id.au> References: <20191108051945.7109-1-joel@jms.id.au> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191107_212055_458310_5A908FFC X-CRM114-Status: GOOD ( 13.68 ) X-Spam-Score: 0.3 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (joel.stan[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Alistar Popple , Eddie James , linux-kernel@vger.kernel.org, Steven Rostedt , Ingo Molnar , linux-arm-kernel@lists.infradead.org, linux-fsi@lists.ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org These trace points help with debugging the FSI master. They show the low level reads, writes and error states of the master. Signed-off-by: Joel Stanley --- v2: remove unnecessary semicolon --- drivers/fsi/fsi-master-aspeed.c | 22 +++++++ include/trace/events/fsi_master_aspeed.h | 77 ++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 include/trace/events/fsi_master_aspeed.h diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index d1b83f035483..95e226ac78b9 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -77,6 +77,9 @@ static const u32 fsi_base = 0xa0000000; #define XFER_HALFWORD (BIT(0)) #define XFER_BYTE (0) +#define CREATE_TRACE_POINTS +#include + #define FSI_LINK_ENABLE_SETUP_TIME 10 /* in mS */ #define DEFAULT_DIVISOR 14 @@ -102,6 +105,8 @@ 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) return ret; @@ -149,6 +154,10 @@ 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) return ret; @@ -196,6 +205,19 @@ 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 new file mode 100644 index 000000000000..a355ceacc33f --- /dev/null +++ b/include/trace/events/fsi_master_aspeed.h @@ -0,0 +1,77 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM fsi_master_aspeed + +#if !defined(_TRACE_FSI_MASTER_ASPEED_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_FSI_MASTER_ASPEED_H + +#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), + TP_STRUCT__entry( + __field(uint32_t, addr) + __field(size_t, size) + __field(uint32_t, result) + __field(uint32_t, status) + __field(uint32_t, irq_status) + ), + 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 + ) +); + +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), + TP_STRUCT__entry( + __field(uint32_t, addr) + __field(uint32_t, val) + __field(size_t, size) + __field(uint32_t, status) + __field(uint32_t, irq_status) + ), + TP_fast_assign( + __entry->addr = addr; + __entry->val = val; + __entry->size = size; + __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 + ) + ); + +#endif + +#include From patchwork Fri Nov 8 05:19:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 11234123 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FDED1390 for ; Fri, 8 Nov 2019 05:23:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2D54D21882 for ; Fri, 8 Nov 2019 05:23:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PlmemKPn"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FxjdFP0W" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2D54D21882 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rKMM0yZueQW9l/2ZMJcwJh+4J6ZstpkMQRV5j3EY9To=; b=PlmemKPnlNT/Oa o6W85AedOfoP7hvV48LVw57ZD3T6Q/NzOEWOhklw4ZuySI9ynmw8v24LTUFqfhc8vBsSef0mSE18E Hh6OfxCBXpZBiNId9K/DIpn01D/F2rMOEkTzS8uyYYmzOSdpPGHp2qS3oTQp2GJAl501zHxLNc9O1 NDJqINYCmwsvzn8GLmrzJdb9p8D/vMLJ4gND+jl7A3Y1QD5ad0umfjnjDzmIrRwWK69AAaCNXhHRn 9jzQ3EYY/fq9zX1ZUxc1Llv+o5aGpWWje9J9CzTUG9qhhoqf6lo9vGHUsiatUi9+xSubaSO+0rKZt W6MIhDMMY+JPzj3rhBKQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwjb-0005rE-LF; Fri, 08 Nov 2019 05:22:59 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSwhf-0003oq-U5 for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2019 05:21:01 +0000 Received: by mail-pg1-x542.google.com with SMTP id k13so3323473pgh.3 for ; Thu, 07 Nov 2019 21:20:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pGFx+amGu93F2A50py9iOALjdTJpw7/ItloLfCzH0sg=; b=FxjdFP0WXWrfIrLD+8gcWy/umEQbWOunx9yjkSz/LLLs4K/VyjyX0EgEYa5CMm5F6w SAUoch3awY5CzsHatHgtVRC9h1rmotllGqaN7eQVFoLIwA4Q7Zfr1e8Z2B18dGZ8xAu8 QoYbA/t5omu9u3U2icdTWcCYwlPbKzMHqD+IgJulOgosUZgxH5W3MHmYQI71tuBjOFFx BR8e64XCMSY5iGEB4Z+DLlWTaRinUpFPqPcq4EDdv7x59vVinY1VwRfkEjmIHzX0rDCi +62w0PF625kC9XHstmRDdqFR5vEHmEAF85ioDHVJZVjWR+jFhBb7oYGuTP7cAbiCvHCX TScg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=pGFx+amGu93F2A50py9iOALjdTJpw7/ItloLfCzH0sg=; b=eECfZ8cBzGEvWlkMs5WrtQD+lyJWAH89Hm1kxJVOSS5+9QSyHOIRJy38yDbTE9W+iG k70y1ywVBcgBYWjR2Gqb3UV3PCcghgx06H5tj5nsQgFXfFZOAUXYtiewLitda1XjWKMT 8H6pod+5YI69+4tR/T7q6afKibO6yPWxCMZrEbfHdZdR44qLjCgY9IM3LdDXFhKnOrgM 8dhszf4nAwiIITbR67VlzrC4bwVaR8QoTDpwxv5jMDqVMKiCSsuKRGqmuC27x/vIjm9y EWH1k2R+gXnczD/wCetfg2VzJ0seomYlL2b+fx2I+vfIWcF5iKR95Z33dWvlMWTCwgbF 6ZBQ== X-Gm-Message-State: APjAAAWX4FHTJCJAi7/YSY1BSXTa0NHKT1Zs78bv21dbnvw9jjFi7dcn TXwpT3uaxjjMlUmKjwgf17I= X-Google-Smtp-Source: APXvYqxciNZfaCcNzGy2TBZD43B3E6OOWrVWrEa5IIAHVWjFI1D487hSYs23XimTIBVclBiUU770SA== X-Received: by 2002:a63:234c:: with SMTP id u12mr9244517pgm.384.1573190458914; Thu, 07 Nov 2019 21:20:58 -0800 (PST) Received: from voyager.ibm.com ([36.255.48.244]) by smtp.gmail.com with ESMTPSA id v19sm3798443pjr.14.2019.11.07.21.20.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 21:20:58 -0800 (PST) From: Joel Stanley To: Rob Herring , Greg KH , Jeremy Kerr Subject: [PATCH v2 11/11] fsi: aspeed: Fix OPB0 byte order register values Date: Fri, 8 Nov 2019 15:49:45 +1030 Message-Id: <20191108051945.7109-12-joel@jms.id.au> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20191108051945.7109-1-joel@jms.id.au> References: <20191108051945.7109-1-joel@jms.id.au> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191107_212059_991331_AC8FE53F X-CRM114-Status: GOOD ( 13.43 ) X-Spam-Score: 0.3 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:542 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (joel.stan[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Andrew Jeffery , Alistar Popple , Eddie James , linux-kernel@vger.kernel.org, Steven Rostedt , Ingo Molnar , linux-arm-kernel@lists.infradead.org, linux-fsi@lists.ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Andrew Jeffery The data byte order selection registers in the APB2OPB primarily expose some internal plumbing necessary to get correct write accesses onto the OPB. OPB write cycles require "data mirroring" across the 32-bit data bus to support variable data width slaves that don't implement "byte enables". For slaves that do implement byte enables the master can signal which bytes on the data bus the slave should consider valid. The data mirroring behaviour is specified by the following table: +-----------------+----------+-----------------------------------+ | | | 32-bit Data Bus | +---------+-------+----------+---------+---------+-------+-------+ | | | | | | | | | ABus | Mn_BE | Request | Dbus | Dbus | Dbus | Dbus | | (30:31) | (0:3) | Transfer | 0:7 | 8:15 | 16:23 | 24:31 | | | | Size | byte0 | byte1 | byte2 | byte3 | +---------+-------+----------+---------+---------+-------+-------+ | 00 | 1111 | fullword | byte0 | byte1 | byte2 | byte3 | +---------+-------+----------+---------+---------+-------+-------+ | 00 | 1110 | halfword | byte0 | byte1 | byte2 | | +---------+-------+----------+---------+---------+-------+-------+ | 01 | 0111 | byte | _byte1_ | byte1 | byte2 | byte3 | +---------+-------+----------+---------+---------+-------+-------+ | 00 | 1100 | halfword | byte0 | byte1 | | | +---------+-------+----------+---------+---------+-------+-------+ | 01 | 0110 | byte | _byte1_ | byte1 | byte2 | | +---------+-------+----------+---------+---------+-------+-------+ | 10 | 0011 | halfword | _byte2_ | _byte3_ | byte2 | byte3 | +---------+-------+----------+---------+---------+-------+-------+ | 00 | 1000 | byte | byte0 | | | | +---------+-------+----------+---------+---------+-------+-------+ | 01 | 0100 | byte | _byte1_ | byte1 | | | +---------+-------+----------+---------+---------+-------+-------+ | 10 | 0010 | byte | _byte2_ | | byte2 | | +---------+-------+----------+---------+---------+-------+-------+ | 11 | 0001 | byte | _byte3_ | _byte3_ | | byte3 | +---------+-------+----------+---------+---------+-------+-------+ Mirrored data values are highlighted by underscores in the Dbus columns. The values in the ABus and Request Transfer Size columns correspond to values in the field names listed in the write data order select register descriptions. Similar configuration registers are exposed for reads which enables the secondary purpose of configuring hardware endian conversions. It appears the data bus byte order is switched around in hardware so set the registers such that we can access the correct values for all widths. The values were determined by experimentation on hardware against fixed CFAM register values to configure the read data order, then in combination with the table above and the register layout documentation in the AST2600 datasheet performing write/read cycles to configure the write data order registers. Signed-off-by: Andrew Jeffery Signed-off-by: Joel Stanley Acked-by: Alistair Popple --- drivers/fsi/fsi-master-aspeed.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index 95e226ac78b9..f49742b310c2 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -459,11 +459,11 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) writel(fsi_base, aspeed->base + OPB_FSI_BASE); /* Set read data order */ - writel(0x0011bb1b, aspeed->base + OPB0_READ_ORDER1); + writel(0x00030b1b, aspeed->base + OPB0_READ_ORDER1); /* Set write data order */ - writel(0x0011bb1b, aspeed->base + OPB0_WRITE_ORDER1); - writel(0xffaa5500, aspeed->base + OPB0_WRITE_ORDER2); + writel(0x0011101b, aspeed->base + OPB0_WRITE_ORDER1); + writel(0x0c330f3f, aspeed->base + OPB0_WRITE_ORDER2); /* * Select OPB0 for all operations.