blob: 58ed29c04f742f800d162bc1cfd6c095b79032d2 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From 975717f04388a052cab9d3c3b6828d065372b82a Mon Sep 17 00:00:00 2001
2From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
3Date: Tue, 3 Apr 2018 17:11:07 +0300
4Subject: [PATCH] fsl/fman: add API to get the device behind a fman port
5
6Add an API that retrieves the 'struct device' that the specified fman
7port probed against. The new API will be used in a subsequent iommu
8enablement related patch.
9
10Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
11Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
12---
13 drivers/net/ethernet/freescale/fman/fman_port.c | 14 ++++++++++++++
14 drivers/net/ethernet/freescale/fman/fman_port.h | 2 ++
15 2 files changed, 16 insertions(+)
16
17--- a/drivers/net/ethernet/freescale/fman/fman_port.c
18+++ b/drivers/net/ethernet/freescale/fman/fman_port.c
19@@ -1728,6 +1728,20 @@ u32 fman_port_get_qman_channel_id(struct
20 }
21 EXPORT_SYMBOL(fman_port_get_qman_channel_id);
22
23+/**
24+ * fman_port_get_device
25+ * port: Pointer to the FMan port device
26+ *
27+ * Get the 'struct device' associated to the specified FMan port device
28+ *
29+ * Return: pointer to associated 'struct device'
30+ */
31+struct device *fman_port_get_device(struct fman_port *port)
32+{
33+ return port->dev;
34+}
35+EXPORT_SYMBOL(fman_port_get_device);
36+
37 int fman_port_get_hash_result_offset(struct fman_port *port, u32 *offset)
38 {
39 if (port->buffer_offsets.hash_result_offset == ILLEGAL_BASE)
40--- a/drivers/net/ethernet/freescale/fman/fman_port.h
41+++ b/drivers/net/ethernet/freescale/fman/fman_port.h
42@@ -157,4 +157,6 @@ int fman_port_get_tstamp(struct fman_por
43
44 struct fman_port *fman_port_bind(struct device *dev);
45
46+struct device *fman_port_get_device(struct fman_port *port);
47+
48 #endif /* __FMAN_PORT_H */