Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1032837/?format=api
{ "id": 1032837, "url": "http://patchwork.ozlabs.org/api/patches/1032837/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20190129150143.12681-6-mika.westerberg@linux.intel.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20190129150143.12681-6-mika.westerberg@linux.intel.com>", "list_archive_url": null, "date": "2019-01-29T15:01:20", "name": "[05/28] thunderbolt: Move LC specific functionality into a separate file", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "23dc664ac6084940486449c9a59c4c98ce38cba3", "submitter": { "id": 14534, "url": "http://patchwork.ozlabs.org/api/people/14534/?format=api", "name": "Mika Westerberg", "email": "mika.westerberg@linux.intel.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20190129150143.12681-6-mika.westerberg@linux.intel.com/mbox/", "series": [ { "id": 88859, "url": "http://patchwork.ozlabs.org/api/series/88859/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=88859", "date": "2019-01-29T15:01:18", "name": "thunderbolt: Software connection manager improvements", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/88859/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1032837/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1032837/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming-netdev@ozlabs.org", "Delivered-To": "patchwork-incoming-netdev@ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dmarc=none (p=none dis=none)\n\theader.from=linux.intel.com" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 43pqYw1qbvz9sDr\n\tfor <patchwork-incoming-netdev@ozlabs.org>;\n\tWed, 30 Jan 2019 02:05:40 +1100 (AEDT)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1728914AbfA2PFc (ORCPT\n\t<rfc822;patchwork-incoming-netdev@ozlabs.org>);\n\tTue, 29 Jan 2019 10:05:32 -0500", "from mga07.intel.com ([134.134.136.100]:7039 \"EHLO mga07.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1728196AbfA2PBw (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tTue, 29 Jan 2019 10:01:52 -0500", "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t29 Jan 2019 07:01:51 -0800", "from black.fi.intel.com ([10.237.72.28])\n\tby orsmga001.jf.intel.com with ESMTP; 29 Jan 2019 07:01:48 -0800", "by black.fi.intel.com (Postfix, from userid 1001)\n\tid 62DD537B; Tue, 29 Jan 2019 17:01:44 +0200 (EET)" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.56,537,1539673200\"; d=\"scan'208\";a=\"134112124\"", "From": "Mika Westerberg <mika.westerberg@linux.intel.com>", "To": "linux-kernel@vger.kernel.org", "Cc": "Michael Jamet <michael.jamet@intel.com>,\n\tYehezkel Bernat <YehezkelShB@gmail.com>,\n\tAndreas Noever <andreas.noever@gmail.com>,\n\tLukas Wunner <lukas@wunner.de>, \"David S . Miller\" <davem@davemloft.net>,\n\tMika Westerberg <mika.westerberg@linux.intel.com>,\n\tAndy Shevchenko <andriy.shevchenko@linux.intel.com>,\n\tnetdev@vger.kernel.org", "Subject": "[PATCH 05/28] thunderbolt: Move LC specific functionality into a\n\tseparate file", "Date": "Tue, 29 Jan 2019 18:01:20 +0300", "Message-Id": "<20190129150143.12681-6-mika.westerberg@linux.intel.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20190129150143.12681-1-mika.westerberg@linux.intel.com>", "References": "<20190129150143.12681-1-mika.westerberg@linux.intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "We will be adding more link controller functionality in subsequent\npatches and it does not make sense to keep all that in switch.c, so\nseparate LC functionality into its own file.\n\nSigned-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>\n---\n drivers/thunderbolt/Makefile | 2 +-\n drivers/thunderbolt/lc.c | 21 +++++++++++++++++++++\n drivers/thunderbolt/switch.c | 12 +++++++-----\n drivers/thunderbolt/tb.h | 3 +++\n drivers/thunderbolt/tb_regs.h | 2 ++\n 5 files changed, 34 insertions(+), 6 deletions(-)\n create mode 100644 drivers/thunderbolt/lc.c", "diff": "diff --git a/drivers/thunderbolt/Makefile b/drivers/thunderbolt/Makefile\nindex f2f0de27252b..8531f15d3b3c 100644\n--- a/drivers/thunderbolt/Makefile\n+++ b/drivers/thunderbolt/Makefile\n@@ -1,3 +1,3 @@\n obj-${CONFIG_THUNDERBOLT} := thunderbolt.o\n thunderbolt-objs := nhi.o ctl.o tb.o switch.o cap.o path.o tunnel_pci.o eeprom.o\n-thunderbolt-objs += domain.o dma_port.o icm.o property.o xdomain.o\n+thunderbolt-objs += domain.o dma_port.o icm.o property.o xdomain.o lc.o\ndiff --git a/drivers/thunderbolt/lc.c b/drivers/thunderbolt/lc.c\nnew file mode 100644\nindex 000000000000..2134a55ed837\n--- /dev/null\n+++ b/drivers/thunderbolt/lc.c\n@@ -0,0 +1,21 @@\n+// SPDX-License-Identifier: GPL-2.0\n+/*\n+ * Thunderbolt link controller support\n+ *\n+ * Copyright (C) 2019, Intel Corporation\n+ * Author: Mika Westerberg <mika.westerberg@linux.intel.com>\n+ */\n+\n+#include \"tb.h\"\n+\n+/**\n+ * tb_lc_read_uuid() - Read switch UUID from link controller common register\n+ * @sw: Switch whose UUID is read\n+ * @uuid: UUID is placed here\n+ */\n+int tb_lc_read_uuid(struct tb_switch *sw, u32 *uuid)\n+{\n+\tif (!sw->cap_lc)\n+\t\treturn -EINVAL;\n+\treturn tb_sw_read(sw, uuid, TB_CFG_SWITCH, sw->cap_lc + TB_LC_FUSE, 4);\n+}\ndiff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c\nindex a90d21abed88..bd96eebd8248 100644\n--- a/drivers/thunderbolt/switch.c\n+++ b/drivers/thunderbolt/switch.c\n@@ -1207,6 +1207,10 @@ struct tb_switch *tb_switch_alloc(struct tb *tb, struct device *parent,\n \t}\n \tsw->cap_plug_events = cap;\n \n+\tcap = tb_switch_find_vse_cap(sw, TB_VSE_CAP_LINK_CONTROLLER);\n+\tif (cap > 0)\n+\t\tsw->cap_lc = cap;\n+\n \t/* Root switch is always authorized */\n \tif (!route)\n \t\tsw->authorized = true;\n@@ -1303,7 +1307,7 @@ int tb_switch_configure(struct tb_switch *sw)\n static void tb_switch_set_uuid(struct tb_switch *sw)\n {\n \tu32 uuid[4];\n-\tint cap;\n+\tint ret;\n \n \tif (sw->uuid)\n \t\treturn;\n@@ -1312,10 +1316,8 @@ static void tb_switch_set_uuid(struct tb_switch *sw)\n \t * The newer controllers include fused UUID as part of link\n \t * controller specific registers\n \t */\n-\tcap = tb_switch_find_vse_cap(sw, TB_VSE_CAP_LINK_CONTROLLER);\n-\tif (cap > 0) {\n-\t\ttb_sw_read(sw, uuid, TB_CFG_SWITCH, cap + 3, 4);\n-\t} else {\n+\tret = tb_lc_read_uuid(sw, uuid);\n+\tif (ret) {\n \t\t/*\n \t\t * ICM generates UUID based on UID and fills the upper\n \t\t * two words with ones. This is not strictly following\ndiff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h\nindex 5faec5a8eb98..530464b25dcb 100644\n--- a/drivers/thunderbolt/tb.h\n+++ b/drivers/thunderbolt/tb.h\n@@ -63,6 +63,7 @@ struct tb_switch_nvm {\n * @device_name: Name of the device (or %NULL if not known)\n * @generation: Switch Thunderbolt generation\n * @cap_plug_events: Offset to the plug events capability (%0 if not found)\n+ * @cap_lc: Offset to the link controller capability (%0 if not found)\n * @is_unplugged: The switch is going away\n * @drom: DROM of the switch (%NULL if not found)\n * @nvm: Pointer to the NVM if the switch has one (%NULL otherwise)\n@@ -98,6 +99,7 @@ struct tb_switch {\n \tconst char *device_name;\n \tunsigned int generation;\n \tint cap_plug_events;\n+\tint cap_lc;\n \tbool is_unplugged;\n \tu8 *drom;\n \tstruct tb_switch_nvm *nvm;\n@@ -448,6 +450,7 @@ bool tb_path_is_invalid(struct tb_path *path);\n int tb_drom_read(struct tb_switch *sw);\n int tb_drom_read_uid_only(struct tb_switch *sw, u64 *uid);\n \n+int tb_lc_read_uuid(struct tb_switch *sw, u32 *uuid);\n \n static inline int tb_route_length(u64 route)\n {\ndiff --git a/drivers/thunderbolt/tb_regs.h b/drivers/thunderbolt/tb_regs.h\nindex 6f1ff04ee195..4895ae9f0b40 100644\n--- a/drivers/thunderbolt/tb_regs.h\n+++ b/drivers/thunderbolt/tb_regs.h\n@@ -237,5 +237,7 @@ struct tb_regs_hop {\n \tu32 unknown3:4; /* set to zero */\n } __packed;\n \n+/* Common link controller registers */\n+#define TB_LC_FUSE\t\t\t0x03\n \n #endif\n", "prefixes": [ "05/28" ] }