aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thunderbolt/dma_port.c
diff options
context:
space:
mode:
authorRadion Mirchevsky <radion.mirchevsky@intel.com>2017-10-04 16:43:43 +0300
committerMika Westerberg <mika.westerberg@linux.intel.com>2018-03-09 12:54:11 +0300
commit4bac471da0d6bab6094c42cf82e08280f361fd31 (patch)
tree944b966f8ff14ee0a7d73dab89dc5fe2076f33e0 /drivers/thunderbolt/dma_port.c
parentthunderbolt: Introduce USB only (SL4) security level (diff)
downloadlinux-dev-4bac471da0d6bab6094c42cf82e08280f361fd31.tar.xz
linux-dev-4bac471da0d6bab6094c42cf82e08280f361fd31.zip
thunderbolt: Add support for Intel Titan Ridge
Intel Titan Ridge is the next Thunderbolt 3 controller. The ICM firmware message format in Titan Ridge differs from Falcon Ridge and Alpine Ridge somewhat because it is using route strings addressing devices. In addition to that the DMA port of 4-channel (two port) controller is in different port number than the previous controllers. There are some other minor differences as well. This patch add support for Intel Titan Ridge and the new ICM firmware message format. Signed-off-by: Radion Mirchevsky <radion.mirchevsky@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/dma_port.c')
-rw-r--r--drivers/thunderbolt/dma_port.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/thunderbolt/dma_port.c b/drivers/thunderbolt/dma_port.c
index af6dde347bee..f2701194f810 100644
--- a/drivers/thunderbolt/dma_port.c
+++ b/drivers/thunderbolt/dma_port.c
@@ -170,24 +170,22 @@ static int dma_port_write(struct tb_ctl *ctl, const void *buffer, u64 route,
static int dma_find_port(struct tb_switch *sw)
{
- int port, ret;
- u32 type;
+ static const int ports[] = { 3, 5, 7 };
+ int i;
/*
- * The DMA (NHI) port is either 3 or 5 depending on the
- * controller. Try both starting from 5 which is more common.
+ * The DMA (NHI) port is either 3, 5 or 7 depending on the
+ * controller. Try all of them.
*/
- port = 5;
- ret = dma_port_read(sw->tb->ctl, &type, tb_route(sw), port, 2, 1,
- DMA_PORT_TIMEOUT);
- if (!ret && (type & 0xffffff) == TB_TYPE_NHI)
- return port;
-
- port = 3;
- ret = dma_port_read(sw->tb->ctl, &type, tb_route(sw), port, 2, 1,
- DMA_PORT_TIMEOUT);
- if (!ret && (type & 0xffffff) == TB_TYPE_NHI)
- return port;
+ for (i = 0; i < ARRAY_SIZE(ports); i++) {
+ u32 type;
+ int ret;
+
+ ret = dma_port_read(sw->tb->ctl, &type, tb_route(sw), ports[i],
+ 2, 1, DMA_PORT_TIMEOUT);
+ if (!ret && (type & 0xffffff) == TB_TYPE_NHI)
+ return ports[i];
+ }
return -ENODEV;
}