From: Calvin Johnson <[email protected]>
This patch series provides ACPI support for xgmac_mdio and dpaa2-mac
driver. Most of the DT APIs are replaced with fwnode APIs to handle
both DT and ACPI nodes.
Old patch by Marcin Wojtas: (mdio_bus: Introduce fwnode MDIO helpers),
is reused in this series to get some fwnode mdio helper APIs.
Calvin Johnson (6):
mdio_bus: modify fwnode phy related functions
net/fsl: add ACPI support for mdio bus
device property: fwnode_get_phy_mode: Change API to solve int/unit
warnings
device property: Introduce fwnode_phy_is_fixed_link()
net: phylink: Introduce phylink_fwnode_phy_connect()
dpaa2-eth: Add ACPI support for DPAA2 MAC driver
Marcin Wojtas (1):
mdio_bus: Introduce fwnode MDIO helpers
drivers/base/property.c | 43 ++-
.../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 78 ++++--
drivers/net/ethernet/freescale/xgmac_mdio.c | 63 +++--
.../net/ethernet/marvell/mvpp2/mvpp2_main.c | 7 +-
drivers/net/phy/mdio_bus.c | 244 ++++++++++++++++++
drivers/net/phy/phylink.c | 64 +++++
include/linux/mdio.h | 3 +
include/linux/phylink.h | 2 +
include/linux/property.h | 5 +-
9 files changed, 450 insertions(+), 59 deletions(-)
--
2.17.1
From: Calvin Johnson <[email protected]>
-Add fwnode_get_phy_id to extract phy_id from fwnode compatible property.
-Modify fwnode_mdiobus_register_phy and fwnode_mdiobus_child_is_phy to
get the compatible string and process accordingly.
Signed-off-by: Calvin Johnson <[email protected]>
---
drivers/net/phy/mdio_bus.c | 58 +++++++++++++++++++++++++++-----------
1 file changed, 42 insertions(+), 16 deletions(-)
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index b1830ae2abd9..d806b8294651 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -726,19 +726,43 @@ static int mdio_uevent(struct device *dev, struct kobj_uevent_env *env)
return 0;
}
+/* Extract the clause 22 phy ID from the compatible string of the form
+ * ethernet-phy-idAAAA.BBBB
+ */
+static int fwnode_get_phy_id(struct fwnode_handle *fwnode, u32 *phy_id)
+{
+ const char *cp;
+ unsigned int upper, lower;
+ int ret;
+
+ ret = fwnode_property_read_string(fwnode, "compatible", &cp);
+ if (!ret) {
+ if (sscanf(cp, "ethernet-phy-id%4x.%4x",
+ &upper, &lower) == 2) {
+ *phy_id = ((upper & 0xFFFF) << 16) | (lower & 0xFFFF);
+ return 0;
+ }
+ }
+ return -EINVAL;
+}
+
static int fwnode_mdiobus_register_phy(struct mii_bus *bus,
struct fwnode_handle *child, u32 addr)
{
struct phy_device *phy;
bool is_c45 = false;
int rc;
+ const char *cp;
+ u32 phy_id;
- rc = fwnode_property_match_string(child, "compatible",
- "ethernet-phy-ieee802.3-c45");
- if (!rc)
+ fwnode_property_read_string(child, "compatible", &cp);
+ if (!strcmp(cp, "ethernet-phy-ieee802.3-c45"))
is_c45 = true;
- phy = get_phy_device(bus, addr, is_c45);
+ if (!is_c45 && !fwnode_get_phy_id(child, &phy_id))
+ phy = phy_device_create(bus, addr, phy_id, 0, NULL);
+ else
+ phy = get_phy_device(bus, addr, is_c45);
if (IS_ERR(phy))
return PTR_ERR(phy);
@@ -835,21 +859,23 @@ static int fwnode_mdio_parse_addr(struct device *dev,
static bool fwnode_mdiobus_child_is_phy(struct fwnode_handle *child)
{
int ret;
+ const char *cp;
+ u32 phy_id;
- ret = fwnode_property_match_string(child, "compatible",
- "ethernet-phy-ieee802.3-c45");
- if (!ret)
- return true;
-
- ret = fwnode_property_match_string(child, "compatible",
- "ethernet-phy-ieee802.3-c22");
- if (!ret)
- return true;
-
- if (!fwnode_property_present(child, "compatible"))
+ if (fwnode_get_phy_id(child, &phy_id) != -EINVAL)
return true;
- return false;
+ ret = fwnode_property_read_string(child, "compatible", &cp);
+ if (!ret) {
+ if (!strcmp(cp, "ethernet-phy-ieee802.3-c22"))
+ return true;
+ else if (!strcmp(cp, "ethernet-phy-ieee802.3-c45"))
+ return true;
+ else
+ return false;
+ } else {
+ return false;
+ }
}
/**
--
2.17.1
From: Calvin Johnson <[email protected]>
Add ACPI support for MDIO bus registration while maintaining
the existing DT support.
Signed-off-by: Calvin Johnson <[email protected]>
---
drivers/net/ethernet/freescale/xgmac_mdio.c | 63 ++++++++++++++-------
1 file changed, 42 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c
index c82c85ef5fb3..51db7482b3de 100644
--- a/drivers/net/ethernet/freescale/xgmac_mdio.c
+++ b/drivers/net/ethernet/freescale/xgmac_mdio.c
@@ -2,6 +2,7 @@
* QorIQ 10G MDIO Controller
*
* Copyright 2012 Freescale Semiconductor, Inc.
+ * Copyright 2019 NXP
*
* Authors: Andy Fleming <[email protected]>
* Timur Tabi <[email protected]>
@@ -11,6 +12,7 @@
* kind, whether express or implied.
*/
+#include <linux/acpi.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
@@ -245,14 +247,14 @@ static int xgmac_mdio_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct mii_bus *bus;
- struct resource res;
+ struct resource *res;
struct mdio_fsl_priv *priv;
int ret;
- ret = of_address_to_resource(np, 0, &res);
- if (ret) {
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res) {
dev_err(&pdev->dev, "could not obtain address\n");
- return ret;
+ return -ENODEV;
}
bus = mdiobus_alloc_size(sizeof(struct mdio_fsl_priv));
@@ -263,25 +265,41 @@ static int xgmac_mdio_probe(struct platform_device *pdev)
bus->read = xgmac_mdio_read;
bus->write = xgmac_mdio_write;
bus->parent = &pdev->dev;
- snprintf(bus->id, MII_BUS_ID_SIZE, "%llx", (unsigned long long)res.start);
+ snprintf(bus->id, MII_BUS_ID_SIZE, "%llx",
+ (unsigned long long)res->start);
/* Set the PHY base address */
priv = bus->priv;
- priv->mdio_base = of_iomap(np, 0);
+ priv->mdio_base = devm_ioremap_resource(&pdev->dev, res);
if (!priv->mdio_base) {
ret = -ENOMEM;
goto err_ioremap;
}
- priv->is_little_endian = of_property_read_bool(pdev->dev.of_node,
- "little-endian");
-
- priv->has_a011043 = of_property_read_bool(pdev->dev.of_node,
- "fsl,erratum-a011043");
-
- ret = of_mdiobus_register(bus, np);
- if (ret) {
- dev_err(&pdev->dev, "cannot register MDIO bus\n");
+ if (is_of_node(pdev->dev.fwnode)) {
+ priv->is_little_endian = of_property_read_bool(pdev->dev.of_node,
+ "little-endian");
+
+ priv->has_a011043 = of_property_read_bool(pdev->dev.of_node,
+ "fsl,erratum-a011043");
+
+ ret = of_mdiobus_register(bus, np);
+ if (ret) {
+ dev_err(&pdev->dev, "cannot register MDIO bus\n");
+ goto err_registration;
+ }
+ } else if (is_acpi_node(pdev->dev.fwnode)) {
+ priv->is_little_endian =
+ fwnode_property_read_bool(pdev->dev.fwnode,
+ "little-endian");
+ ret = fwnode_mdiobus_register(bus, pdev->dev.fwnode);
+ if (ret) {
+ dev_err(&pdev->dev, "cannot register MDIO bus\n");
+ goto err_registration;
+ }
+ } else {
+ dev_err(&pdev->dev, "Cannot get cfg data from DT or ACPI\n");
+ ret = -ENXIO;
goto err_registration;
}
@@ -290,8 +308,6 @@ static int xgmac_mdio_probe(struct platform_device *pdev)
return 0;
err_registration:
- iounmap(priv->mdio_base);
-
err_ioremap:
mdiobus_free(bus);
@@ -303,13 +319,12 @@ static int xgmac_mdio_remove(struct platform_device *pdev)
struct mii_bus *bus = platform_get_drvdata(pdev);
mdiobus_unregister(bus);
- iounmap(bus->priv);
mdiobus_free(bus);
return 0;
}
-static const struct of_device_id xgmac_mdio_match[] = {
+static const struct of_device_id xgmac_mdio_of_match[] = {
{
.compatible = "fsl,fman-xmdio",
},
@@ -318,12 +333,18 @@ static const struct of_device_id xgmac_mdio_match[] = {
},
{},
};
-MODULE_DEVICE_TABLE(of, xgmac_mdio_match);
+MODULE_DEVICE_TABLE(of, xgmac_mdio_of_match);
+
+static const struct acpi_device_id xgmac_mdio_acpi_match[] = {
+ {"NXP0006", 0}
+};
+MODULE_DEVICE_TABLE(acpi, xgmac_mdio_acpi_match);
static struct platform_driver xgmac_mdio_driver = {
.driver = {
.name = "fsl-fman_xmdio",
- .of_match_table = xgmac_mdio_match,
+ .of_match_table = xgmac_mdio_of_match,
+ .acpi_match_table = ACPI_PTR(xgmac_mdio_acpi_match),
},
.probe = xgmac_mdio_probe,
.remove = xgmac_mdio_remove,
--
2.17.1
From: Calvin Johnson <[email protected]>
API fwnode_get_phy_mode is modified to follow the changes made by
Commit 0c65b2b90d13c1 ("net: of_get_phy_mode: Change API to solve
int/unit warnings").
Signed-off-by: Calvin Johnson <[email protected]>
---
drivers/base/property.c | 22 ++++++++++++++-----
.../net/ethernet/marvell/mvpp2/mvpp2_main.c | 7 +++---
include/linux/property.h | 4 +++-
3 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 511f6d7acdfe..fdb79033d58f 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -830,16 +830,20 @@ EXPORT_SYMBOL_GPL(device_get_dma_attr);
/**
* fwnode_get_phy_mode - Get phy mode for given firmware node
* @fwnode: Pointer to the given node
+ * @interface: Pointer to the result
*
* The function gets phy interface string from property 'phy-mode' or
- * 'phy-connection-type', and return its index in phy_modes table, or errno in
- * error case.
+ * 'phy-connection-type'. The index in phy_modes table is set in
+ * interface and 0 returned. In case of error interface is set to
+ * PHY_INTERFACE_MODE_NA and an errno is returned, e.g. -ENODEV.
*/
-int fwnode_get_phy_mode(struct fwnode_handle *fwnode)
+int fwnode_get_phy_mode(struct fwnode_handle *fwnode, phy_interface_t *interface)
{
const char *pm;
int err, i;
+ *interface = PHY_INTERFACE_MODE_NA;
+
err = fwnode_property_read_string(fwnode, "phy-mode", &pm);
if (err < 0)
err = fwnode_property_read_string(fwnode,
@@ -848,8 +852,10 @@ int fwnode_get_phy_mode(struct fwnode_handle *fwnode)
return err;
for (i = 0; i < PHY_INTERFACE_MODE_MAX; i++)
- if (!strcasecmp(pm, phy_modes(i)))
+ if (!strcasecmp(pm, phy_modes(i))) {
+ *interface = i;
return i;
+ }
return -ENODEV;
}
@@ -865,7 +871,13 @@ EXPORT_SYMBOL_GPL(fwnode_get_phy_mode);
*/
int device_get_phy_mode(struct device *dev)
{
- return fwnode_get_phy_mode(dev_fwnode(dev));
+ int ret;
+ phy_interface_t phy_mode;
+
+ ret = fwnode_get_phy_mode(dev_fwnode(dev), &phy_mode);
+ if (!ret)
+ ret = phy_mode;
+ return ret;
}
EXPORT_SYMBOL_GPL(device_get_phy_mode);
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 14e372cda7f4..00a0350f4da7 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -5209,7 +5209,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
unsigned long flags = 0;
bool has_tx_irqs;
u32 id;
- int phy_mode;
+ phy_interface_t phy_mode;
int err, i;
has_tx_irqs = mvpp2_port_has_irqs(priv, port_node, &flags);
@@ -5226,10 +5226,9 @@ static int mvpp2_port_probe(struct platform_device *pdev,
if (!dev)
return -ENOMEM;
- phy_mode = fwnode_get_phy_mode(port_fwnode);
- if (phy_mode < 0) {
+ err = fwnode_get_phy_mode(port_fwnode, &phy_mode);
+ if (err < 0) {
dev_err(&pdev->dev, "incorrect phy mode\n");
- err = phy_mode;
goto err_free_netdev;
}
diff --git a/include/linux/property.h b/include/linux/property.h
index 48335288c2a9..1998f502d2ed 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -13,6 +13,7 @@
#include <linux/bits.h>
#include <linux/fwnode.h>
#include <linux/types.h>
+#include <linux/phy.h>
struct device;
@@ -332,7 +333,8 @@ int device_get_phy_mode(struct device *dev);
void *device_get_mac_address(struct device *dev, char *addr, int alen);
-int fwnode_get_phy_mode(struct fwnode_handle *fwnode);
+int fwnode_get_phy_mode(struct fwnode_handle *fwnode,
+ phy_interface_t *interface);
void *fwnode_get_mac_address(struct fwnode_handle *fwnode,
char *addr, int alen);
struct fwnode_handle *fwnode_graph_get_next_endpoint(
--
2.17.1
From: Calvin Johnson <[email protected]>
Introduce fwnode_phy_is_fixed_link() function that an Ethernet driver
can call on its PHY phandle to find out whether it's a fixed link PHY
or not.
Signed-off-by: Calvin Johnson <[email protected]>
---
drivers/base/property.c | 21 +++++++++++++++++++++
include/linux/property.h | 1 +
2 files changed, 22 insertions(+)
diff --git a/drivers/base/property.c b/drivers/base/property.c
index fdb79033d58f..a0f69fae82cd 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -827,6 +827,27 @@ enum dev_dma_attr device_get_dma_attr(struct device *dev)
}
EXPORT_SYMBOL_GPL(device_get_dma_attr);
+/*
+ * fwnode_phy_is_fixed_link()
+ */
+bool fwnode_phy_is_fixed_link(struct fwnode_handle *fwnode)
+{
+ struct fwnode_handle *fixed_node;
+ int len, err;
+ const char *managed;
+
+ fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
+ if (fixed_node)
+ return fixed_node;
+
+ err = fwnode_property_read_string(fixed_node, "managed", &managed);
+ if (err == 0 && strcmp(managed, "auto") != 0)
+ return true;
+
+ return false;
+}
+EXPORT_SYMBOL(fwnode_phy_is_fixed_link);
+
/**
* fwnode_get_phy_mode - Get phy mode for given firmware node
* @fwnode: Pointer to the given node
diff --git a/include/linux/property.h b/include/linux/property.h
index 1998f502d2ed..ba89fcf091c8 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -333,6 +333,7 @@ int device_get_phy_mode(struct device *dev);
void *device_get_mac_address(struct device *dev, char *addr, int alen);
+bool fwnode_phy_is_fixed_link(struct fwnode_handle *fwnode);
int fwnode_get_phy_mode(struct fwnode_handle *fwnode,
phy_interface_t *interface);
void *fwnode_get_mac_address(struct fwnode_handle *fwnode,
--
2.17.1
From: Calvin Johnson <[email protected]>
Introduce phylink_fwnode_phy_connect API to connect the PHY using
fwnode.
Signed-off-by: Calvin Johnson <[email protected]>
---
drivers/net/phy/phylink.c | 64 +++++++++++++++++++++++++++++++++++++++
include/linux/phylink.h | 2 ++
2 files changed, 66 insertions(+)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index ee7a718662c6..f211f62283b5 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -18,6 +18,7 @@
#include <linux/spinlock.h>
#include <linux/timer.h>
#include <linux/workqueue.h>
+#include <linux/acpi.h>
#include "sfp.h"
#include "swphy.h"
@@ -817,6 +818,69 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
}
EXPORT_SYMBOL_GPL(phylink_connect_phy);
+/**
+ * phylink_fwnode_phy_connect() - connect the PHY specified in the fwnode.
+ * @pl: a pointer to a &struct phylink returned from phylink_create()
+ * @dn: a pointer to a &struct device_node.
+ * @flags: PHY-specific flags to communicate to the PHY device driver
+ *
+ * Connect the phy specified in the device node @dn to the phylink instance
+ * specified by @pl. Actions specified in phylink_connect_phy() will be
+ * performed.
+ *
+ * Returns 0 on success or a negative errno.
+ */
+int phylink_fwnode_phy_connect(struct phylink *pl,
+ struct fwnode_handle *fwnode,
+ u32 flags)
+{
+ struct fwnode_handle *phy_node;
+ struct phy_device *phy_dev;
+ int ret;
+ int status;
+ struct fwnode_reference_args args;
+
+ /* Fixed links and 802.3z are handled without needing a PHY */
+ if (pl->link_an_mode == MLO_AN_FIXED ||
+ (pl->link_an_mode == MLO_AN_INBAND &&
+ phy_interface_mode_is_8023z(pl->link_interface)))
+ return 0;
+
+ status = acpi_node_get_property_reference(fwnode, "phy-handle", 0,
+ &args);
+ if (ACPI_FAILURE(status) || !is_acpi_device_node(args.fwnode))
+ status = acpi_node_get_property_reference(fwnode, "phy", 0,
+ &args);
+ if (ACPI_FAILURE(status) || !is_acpi_device_node(args.fwnode))
+ status = acpi_node_get_property_reference(fwnode,
+ "phy-device", 0,
+ &args);
+
+ if (ACPI_FAILURE(status) || !is_acpi_device_node(args.fwnode)) {
+ if (pl->link_an_mode == MLO_AN_PHY)
+ return -ENODEV;
+ return 0;
+ }
+
+ phy_dev = fwnode_phy_find_device(args.fwnode);
+ if (phy_dev)
+ phy_attach_direct(pl->netdev, phy_dev, flags,
+ pl->link_interface);
+
+ /* refcount is held by phy_attach_direct() on success */
+ put_device(&phy_dev->mdio.dev);
+
+ if (!phy_dev)
+ return -ENODEV;
+
+ ret = phylink_bringup_phy(pl, phy_dev);
+ if (ret)
+ phy_detach(phy_dev);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(phylink_fwnode_phy_connect);
+
/**
* phylink_of_phy_connect() - connect the PHY specified in the DT mode.
* @pl: a pointer to a &struct phylink returned from phylink_create()
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index fed5488e3c75..cb07cf7a832e 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -240,6 +240,8 @@ void phylink_destroy(struct phylink *);
int phylink_connect_phy(struct phylink *, struct phy_device *);
int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags);
+int phylink_fwnode_phy_connect(struct phylink *pl, struct fwnode_handle *fwnode,
+ u32 flags);
void phylink_disconnect_phy(struct phylink *);
int phylink_fixed_state_cb(struct phylink *,
void (*cb)(struct net_device *dev,
--
2.17.1
From: Calvin Johnson <[email protected]>
fwnode APIs are used to handle both DT and ACPI nodes.
Whereever common fwnode APIs cannot be used, corresponding DT
and ACPI APIs are used.
Signed-off-by: Calvin Johnson <[email protected]>
---
.../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 78 ++++++++++++-------
1 file changed, 50 insertions(+), 28 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
index 84233e467ed1..29d2d85383de 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
@@ -3,6 +3,7 @@
#include "dpaa2-eth.h"
#include "dpaa2-mac.h"
+#include <linux/acpi.h>
#define phylink_to_dpaa2_mac(config) \
container_of((config), struct dpaa2_mac, phylink_config)
@@ -23,37 +24,51 @@ static int phy_mode(enum dpmac_eth_if eth_if, phy_interface_t *if_mode)
}
/* Caller must call of_node_put on the returned value */
-static struct device_node *dpaa2_mac_get_node(u16 dpmac_id)
+static struct fwnode_handle *dpaa2_mac_get_node(struct device *dev,
+ u16 dpmac_id)
{
- struct device_node *dpmacs, *dpmac = NULL;
+ struct fwnode_handle *dpmac_fwnode;
+ struct fwnode_handle *dpmacs, *dpmac = NULL;
u32 id;
int err;
- dpmacs = of_find_node_by_name(NULL, "dpmacs");
- if (!dpmacs)
- return NULL;
+ if (is_of_node(dev->parent->fwnode)) {
+ dpmacs = device_get_named_child_node(dev->parent, "dpmacs");
+ if (!dpmacs)
+ return NULL;
+
+ while ((dpmac = fwnode_get_next_child_node(dpmacs, dpmac))) {
+ err = fwnode_property_read_u32(dpmac, "reg", &id);
+ if (err)
+ continue;
+ if (id == dpmac_id)
+ return dpmac;
+ }
- while ((dpmac = of_get_next_child(dpmacs, dpmac)) != NULL) {
- err = of_property_read_u32(dpmac, "reg", &id);
- if (err)
- continue;
- if (id == dpmac_id)
- break;
+ } else if (is_acpi_node(dev->parent->fwnode)) {
+ device_for_each_child_node(dev->parent, dpmac_fwnode) {
+ err = fwnode_property_read_u32(dpmac_fwnode, "reg",
+ &id);
+ if (err) {
+ dev_err(dev->parent, "failed to get reg\n");
+ continue;
+ } else {
+ if (id == dpmac_id)
+ return dpmac_fwnode;
+ }
+ }
}
-
- of_node_put(dpmacs);
-
- return dpmac;
+ return NULL;
}
-static int dpaa2_mac_get_if_mode(struct device_node *node,
+static int dpaa2_mac_get_if_mode(struct fwnode_handle *dpmac_fwnode,
struct dpmac_attr attr)
{
phy_interface_t if_mode;
int err;
- err = of_get_phy_mode(node, &if_mode);
- if (!err)
+ err = fwnode_get_phy_mode(dpmac_fwnode, &if_mode);
+ if (err > 0)
return if_mode;
err = phy_mode(attr.eth_if, &if_mode);
@@ -220,7 +235,7 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac)
{
struct fsl_mc_device *dpmac_dev = mac->mc_dev;
struct net_device *net_dev = mac->net_dev;
- struct device_node *dpmac_node;
+ struct fwnode_handle *dpmac_fwnode = NULL;
struct phylink *phylink;
struct dpmac_attr attr;
int err;
@@ -238,25 +253,26 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac)
goto err_close_dpmac;
}
- dpmac_node = dpaa2_mac_get_node(attr.id);
- if (!dpmac_node) {
+ dpmac_fwnode = dpaa2_mac_get_node(&mac->mc_dev->dev, attr.id);
+ if (!dpmac_fwnode) {
netdev_err(net_dev, "No dpmac@%d node found.\n", attr.id);
err = -ENODEV;
goto err_close_dpmac;
}
- err = dpaa2_mac_get_if_mode(dpmac_node, attr);
+ err = dpaa2_mac_get_if_mode(dpmac_fwnode, attr);
if (err < 0) {
err = -EINVAL;
goto err_put_node;
}
+
mac->if_mode = err;
/* The MAC does not have the capability to add RGMII delays so
* error out if the interface mode requests them and there is no PHY
* to act upon them
*/
- if (of_phy_is_fixed_link(dpmac_node) &&
+ if (fwnode_phy_is_fixed_link(dpmac_fwnode) &&
(mac->if_mode == PHY_INTERFACE_MODE_RGMII_ID ||
mac->if_mode == PHY_INTERFACE_MODE_RGMII_RXID ||
mac->if_mode == PHY_INTERFACE_MODE_RGMII_TXID)) {
@@ -269,7 +285,7 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac)
mac->phylink_config.type = PHYLINK_NETDEV;
phylink = phylink_create(&mac->phylink_config,
- of_fwnode_handle(dpmac_node), mac->if_mode,
+ dpmac_fwnode, mac->if_mode,
&dpaa2_mac_phylink_ops);
if (IS_ERR(phylink)) {
err = PTR_ERR(phylink);
@@ -277,20 +293,26 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac)
}
mac->phylink = phylink;
- err = phylink_of_phy_connect(mac->phylink, dpmac_node, 0);
+ if (is_of_node(dpmac_fwnode))
+ err = phylink_of_phy_connect(mac->phylink,
+ to_of_node(dpmac_fwnode), 0);
+ else if (is_acpi_node(dpmac_fwnode))
+ err = phylink_fwnode_phy_connect(mac->phylink, dpmac_fwnode, 0);
if (err) {
- netdev_err(net_dev, "phylink_of_phy_connect() = %d\n", err);
+ netdev_err(net_dev, "phylink_fwnode_phy_connect() = %d\n", err);
goto err_phylink_destroy;
}
- of_node_put(dpmac_node);
+ if (is_of_node(dpmac_fwnode))
+ of_node_put(to_of_node(dpmac_fwnode));
return 0;
err_phylink_destroy:
phylink_destroy(mac->phylink);
err_put_node:
- of_node_put(dpmac_node);
+ if (is_of_node(dpmac_fwnode))
+ of_node_put(to_of_node(dpmac_fwnode));
err_close_dpmac:
dpmac_close(mac->mc_io, 0, dpmac_dev->mc_handle);
return err;
--
2.17.1
On Fri, Jan 31, 2020 at 5:38 PM Calvin Johnson <[email protected]> wrote:
>
> From: Calvin Johnson <[email protected]>
>
> API fwnode_get_phy_mode is modified to follow the changes made by
> Commit 0c65b2b90d13c1 ("net: of_get_phy_mode: Change API to solve
> int/unit warnings").
I think it would be good to base your series on Dan's fix patch.
--
With Best Regards,
Andy Shevchenko
On Fri, Jan 31, 2020 at 5:38 PM Calvin Johnson <[email protected]> wrote:
>
> From: Calvin Johnson <[email protected]>
>
> Introduce fwnode_phy_is_fixed_link() function that an Ethernet driver
> can call on its PHY phandle to find out whether it's a fixed link PHY
> or not.
> +/*
> + * fwnode_phy_is_fixed_link()
> + */
Please, do a full kernel doc description.
> +bool fwnode_phy_is_fixed_link(struct fwnode_handle *fwnode)
> +{
> + struct fwnode_handle *fixed_node;
> + int len, err;
> + const char *managed;
> +
> + fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
> + if (fixed_node)
> + return fixed_node;
> +
> + err = fwnode_property_read_string(fixed_node, "managed", &managed);
> + if (err == 0 && strcmp(managed, "auto") != 0)
> + return true;
> +
> + return false;
Maybe other way around?
if (err)
return false;
return !strcmp(managed, "auto");
?
Same pattern perhaps for the patch where you introduce fwnode_get_phy_mode().
> +}
--
With Best Regards,
Andy Shevchenko
On Fri, Jan 31, 2020 at 5:37 PM Calvin Johnson <[email protected]> wrote:
>
> From: Calvin Johnson <[email protected]>
>
> Add ACPI support for MDIO bus registration while maintaining
> the existing DT support.
...
> - ret = of_address_to_resource(np, 0, &res);
> - if (ret) {
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res) {
> dev_err(&pdev->dev, "could not obtain address\n");
> - return ret;
> + return -ENODEV;
> }
...
> - snprintf(bus->id, MII_BUS_ID_SIZE, "%llx", (unsigned long long)res.start);
> + snprintf(bus->id, MII_BUS_ID_SIZE, "%llx",
> + (unsigned long long)res->start);
Why this has been touched?
...
> - priv->mdio_base = of_iomap(np, 0);
> + priv->mdio_base = devm_ioremap_resource(&pdev->dev, res);
> if (!priv->mdio_base) {
Are you sure the check is correct now?
> ret = -ENOMEM;
> goto err_ioremap;
> }
...
>
> - priv->is_little_endian = of_property_read_bool(pdev->dev.of_node,
> - "little-endian");
> -
> - priv->has_a011043 = of_property_read_bool(pdev->dev.of_node,
> - "fsl,erratum-a011043");
> -
> - ret = of_mdiobus_register(bus, np);
> - if (ret) {
> - dev_err(&pdev->dev, "cannot register MDIO bus\n");
> + if (is_of_node(pdev->dev.fwnode)) {
> + } else if (is_acpi_node(pdev->dev.fwnode)) {
Oh, no, this is wrong. Pure approach AFAICS is to use fwnode API or
device property API.
And actually what you need to include is rather <linux/property.h>,
and not acpi.h.
> + } else {
> + dev_err(&pdev->dev, "Cannot get cfg data from DT or ACPI\n");
> + ret = -ENXIO;
> goto err_registration;
> }
> +static const struct acpi_device_id xgmac_mdio_acpi_match[] = {
> + {"NXP0006", 0}
How did you test this on platforms with the same IP and without device
of this ACPI ID present?
(Hint: missed terminator)
> +};
> +MODULE_DEVICE_TABLE(acpi, xgmac_mdio_acpi_match);
> + .acpi_match_table = ACPI_PTR(xgmac_mdio_acpi_match),
ACPI_PTR is not needed otherwise you will get a compiler warning.
--
With Best Regards,
Andy Shevchenko
Hi Calvin,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on v5.5]
[cannot apply to driver-core/driver-core-testing net-next/master net/master linus/master sparc-next/master next-20200131]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Calvin-Johnson/ACPI-support-for-xgmac_mdio-and-dpaa2-mac-drivers/20200203-070754
base: d5226fa6dbae0569ee43ecfc08bdcd6770fc4755
config: x86_64-defconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-3) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email protected]>
Note: the linux-review/Calvin-Johnson/ACPI-support-for-xgmac_mdio-and-dpaa2-mac-drivers/20200203-070754 HEAD 90ffe7e2e45e6e2671084e1169a7bd16c6b3cc8d builds fine.
It only hurts bisectibility.
All error/warnings (new ones prefixed by >>):
^~~~~~
PORT_E
drivers/gpu/drm/i915/display/intel_display.h:226:7: error: 'PORT_G' undeclared (first use in this function); did you mean 'PORT_F'?
case PORT_G:
^~~~~~
PORT_F
drivers/gpu/drm/i915/display/intel_display.h:228:7: error: 'PORT_H' undeclared (first use in this function); did you mean 'PORT_G'?
case PORT_H:
^~~~~~
PORT_G
drivers/gpu/drm/i915/display/intel_display.h:230:7: error: 'PORT_I' undeclared (first use in this function); did you mean 'PORT_H'?
case PORT_I:
^~~~~~
PORT_H
In file included from drivers/gpu/drm/i915/display/intel_bios.c:34:0:
drivers/gpu/drm/i915/i915_drv.h: At top level:
drivers/gpu/drm/i915/i915_drv.h:730:41: error: 'I915_MAX_PORTS' undeclared here (not in a function); did you mean 'I915_MAX_PHYS'?
struct ddi_vbt_port_info ddi_port_info[I915_MAX_PORTS];
^~~~~~~~~~~~~~
I915_MAX_PHYS
In file included from include/linux/bitops.h:5:0,
from include/linux/kernel.h:12,
from include/linux/delay.h:22,
from include/drm/drm_dp_helper.h:26,
from drivers/gpu/drm/i915/display/intel_bios.c:28:
drivers/gpu/drm/i915/display/intel_bios.c: In function 'parse_dsi_backlight_ports':
drivers/gpu/drm/i915/display/intel_bios.c:807:36: error: 'PORT_A' undeclared (first use in this function); did you mean 'PORT_DA'?
dev_priv->vbt.dsi.bl_ports = BIT(PORT_A);
^
include/linux/bits.h:8:30: note: in definition of macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^~
drivers/gpu/drm/i915/display/intel_bios.c:810:36: error: 'PORT_C' undeclared (first use in this function); did you mean 'PORT_A'?
dev_priv->vbt.dsi.bl_ports = BIT(PORT_C);
^
include/linux/bits.h:8:30: note: in definition of macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^~
drivers/gpu/drm/i915/display/intel_bios.c: In function 'get_port_by_ddc_pin':
drivers/gpu/drm/i915/display/intel_bios.c:1249:14: error: 'PORT_A' undeclared (first use in this function); did you mean 'PORT_DA'?
for (port = PORT_A; port < I915_MAX_PORTS; port++) {
^~~~~~
PORT_DA
drivers/gpu/drm/i915/display/intel_bios.c: In function 'get_port_by_aux_ch':
drivers/gpu/drm/i915/display/intel_bios.c:1300:14: error: 'PORT_A' undeclared (first use in this function); did you mean 'PORT_DA'?
for (port = PORT_A; port < I915_MAX_PORTS; port++) {
^~~~~~
PORT_DA
drivers/gpu/drm/i915/display/intel_bios.c: In function 'dvo_port_to_port':
drivers/gpu/drm/i915/display/intel_bios.c:1396:4: error: 'PORT_A' undeclared (first use in this function); did you mean 'PORT_DA'?
[PORT_A] = { DVO_PORT_HDMIA, DVO_PORT_DPA, -1},
^~~~~~
PORT_DA
drivers/gpu/drm/i915/display/intel_bios.c:1396:4: error: array index in initializer not of integer type
drivers/gpu/drm/i915/display/intel_bios.c:1396:4: note: (near initialization for 'dvo_ports')
drivers/gpu/drm/i915/display/intel_bios.c:1397:4: error: 'PORT_B' undeclared (first use in this function); did you mean 'PORT_A'?
[PORT_B] = { DVO_PORT_HDMIB, DVO_PORT_DPB, -1},
^~~~~~
PORT_A
drivers/gpu/drm/i915/display/intel_bios.c:1397:4: error: array index in initializer not of integer type
drivers/gpu/drm/i915/display/intel_bios.c:1397:4: note: (near initialization for 'dvo_ports')
drivers/gpu/drm/i915/display/intel_bios.c:1398:4: error: 'PORT_C' undeclared (first use in this function); did you mean 'PORT_B'?
[PORT_C] = { DVO_PORT_HDMIC, DVO_PORT_DPC, -1},
^~~~~~
PORT_B
drivers/gpu/drm/i915/display/intel_bios.c:1398:4: error: array index in initializer not of integer type
drivers/gpu/drm/i915/display/intel_bios.c:1398:4: note: (near initialization for 'dvo_ports')
drivers/gpu/drm/i915/display/intel_bios.c:1399:4: error: 'PORT_D' undeclared (first use in this function); did you mean 'PORT_C'?
[PORT_D] = { DVO_PORT_HDMID, DVO_PORT_DPD, -1},
^~~~~~
PORT_C
drivers/gpu/drm/i915/display/intel_bios.c:1399:4: error: array index in initializer not of integer type
drivers/gpu/drm/i915/display/intel_bios.c:1399:4: note: (near initialization for 'dvo_ports')
drivers/gpu/drm/i915/display/intel_bios.c:1400:4: error: 'PORT_E' undeclared (first use in this function); did you mean 'PORT_D'?
[PORT_E] = { DVO_PORT_CRT, DVO_PORT_HDMIE, DVO_PORT_DPE},
^~~~~~
PORT_D
drivers/gpu/drm/i915/display/intel_bios.c:1400:4: error: array index in initializer not of integer type
drivers/gpu/drm/i915/display/intel_bios.c:1400:4: note: (near initialization for 'dvo_ports')
drivers/gpu/drm/i915/display/intel_bios.c:1401:4: error: 'PORT_F' undeclared (first use in this function); did you mean 'PORT_E'?
[PORT_F] = { DVO_PORT_HDMIF, DVO_PORT_DPF, -1},
^~~~~~
PORT_E
drivers/gpu/drm/i915/display/intel_bios.c:1401:4: error: array index in initializer not of integer type
drivers/gpu/drm/i915/display/intel_bios.c:1401:4: note: (near initialization for 'dvo_ports')
drivers/gpu/drm/i915/display/intel_bios.c:1402:4: error: 'PORT_G' undeclared (first use in this function); did you mean 'PORT_F'?
[PORT_G] = { DVO_PORT_HDMIG, DVO_PORT_DPG, -1},
^~~~~~
PORT_F
drivers/gpu/drm/i915/display/intel_bios.c:1402:4: error: array index in initializer not of integer type
drivers/gpu/drm/i915/display/intel_bios.c:1402:4: note: (near initialization for 'dvo_ports')
drivers/gpu/drm/i915/display/intel_bios.c: In function 'parse_ddi_port':
drivers/gpu/drm/i915/display/intel_bios.c:1446:14: error: 'PORT_A' undeclared (first use in this function); did you mean 'PORT_DA'?
if (port == PORT_A && is_dvi) {
^~~~~~
PORT_DA
drivers/gpu/drm/i915/display/intel_bios.c:1472:24: error: 'PORT_E' undeclared (first use in this function); did you mean 'PORT_A'?
if (is_crt && port != PORT_E)
^~~~~~
PORT_A
>> drivers/gpu/drm/i915/display/intel_bios.c:1482:25: error: 'PORT_B' undeclared (first use in this function); did you mean 'PORT_E'?
if (is_edp && (port == PORT_B || port == PORT_C || port == PORT_E))
^~~~~~
PORT_E
drivers/gpu/drm/i915/display/intel_bios.c:1482:43: error: 'PORT_C' undeclared (first use in this function); did you mean 'PORT_B'?
if (is_edp && (port == PORT_B || port == PORT_C || port == PORT_E))
^~~~~~
PORT_B
drivers/gpu/drm/i915/display/intel_bios.c: In function 'init_vbt_defaults':
drivers/gpu/drm/i915/display/intel_bios.c:1725:14: error: 'PORT_A' undeclared (first use in this function); did you mean 'PORT_DA'?
for (port = PORT_A; port < I915_MAX_PORTS; port++) {
^~~~~~
PORT_DA
drivers/gpu/drm/i915/display/intel_bios.c: In function 'init_vbt_missing_defaults':
drivers/gpu/drm/i915/display/intel_bios.c:1739:14: error: 'PORT_A' undeclared (first use in this function); did you mean 'PORT_DA'?
for (port = PORT_A; port < I915_MAX_PORTS; port++) {
^~~~~~
PORT_DA
drivers/gpu/drm/i915/display/intel_bios.c:1751:51: error: 'PORT_E' undeclared (first use in this function); did you mean 'PORT_A'?
info->supports_dvi = (port != PORT_A && port != PORT_E);
^~~~~~
PORT_A
drivers/gpu/drm/i915/display/intel_bios.c: In function 'intel_bios_is_port_present':
drivers/gpu/drm/i915/display/intel_bios.c:2027:4: error: 'PORT_B' undeclared (first use in this function); did you mean 'PORT_BNC'?
[PORT_B] = { DVO_PORT_DPB, DVO_PORT_HDMIB, },
^~~~~~
PORT_BNC
drivers/gpu/drm/i915/display/intel_bios.c:2027:4: error: array index in initializer not of integer type
drivers/gpu/drm/i915/display/intel_bios.c:2027:4: note: (near initialization for 'port_mapping')
drivers/gpu/drm/i915/display/intel_bios.c:2028:4: error: 'PORT_C' undeclared (first use in this function); did you mean 'PORT_B'?
[PORT_C] = { DVO_PORT_DPC, DVO_PORT_HDMIC, },
^~~~~~
PORT_B
drivers/gpu/drm/i915/display/intel_bios.c:2028:4: error: array index in initializer not of integer type
drivers/gpu/drm/i915/display/intel_bios.c:2028:4: note: (near initialization for 'port_mapping')
drivers/gpu/drm/i915/display/intel_bios.c:2029:4: error: 'PORT_D' undeclared (first use in this function); did you mean 'PORT_C'?
[PORT_D] = { DVO_PORT_DPD, DVO_PORT_HDMID, },
^~~~~~
PORT_C
drivers/gpu/drm/i915/display/intel_bios.c:2029:4: error: array index in initializer not of integer type
drivers/gpu/drm/i915/display/intel_bios.c:2029:4: note: (near initialization for 'port_mapping')
drivers/gpu/drm/i915/display/intel_bios.c:2030:4: error: 'PORT_E' undeclared (first use in this function); did you mean 'PORT_D'?
[PORT_E] = { DVO_PORT_DPE, DVO_PORT_HDMIE, },
^~~~~~
PORT_D
drivers/gpu/drm/i915/display/intel_bios.c:2030:4: error: array index in initializer not of integer type
drivers/gpu/drm/i915/display/intel_bios.c:2030:4: note: (near initialization for 'port_mapping')
drivers/gpu/drm/i915/display/intel_bios.c:2031:4: error: 'PORT_F' undeclared (first use in this function); did you mean 'PORT_E'?
[PORT_F] = { DVO_PORT_DPF, DVO_PORT_HDMIF, },
^~~~~~
PORT_E
drivers/gpu/drm/i915/display/intel_bios.c:2031:4: error: array index in initializer not of integer type
drivers/gpu/drm/i915/display/intel_bios.c:2031:4: note: (near initialization for 'port_mapping')
In file included from arch/x86/include/asm/bug.h:83:0,
from include/linux/bug.h:5,
from include/linux/cpumask.h:14,
from arch/x86/include/asm/cpumask.h:5,
from arch/x86/include/asm/msr.h:11,
from arch/x86/include/asm/processor.h:22,
from include/linux/mutex.h:19,
from include/linux/kernfs.h:12,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/of.h:17,
from include/linux/irqdomain.h:35,
from include/linux/acpi.h:13,
from include/linux/i2c.h:13,
from include/drm/drm_dp_helper.h:27,
from drivers/gpu/drm/i915/display/intel_bios.c:28:
drivers/gpu/drm/i915/display/intel_bios.c:2045:22: error: 'PORT_A' undeclared (first use in this function); did you mean 'PORT_F'?
if (WARN_ON(port == PORT_A) || port >= ARRAY_SIZE(port_mapping))
^
include/asm-generic/bug.h:122:25: note: in definition of macro 'WARN'
int __ret_warn_on = !!(condition); \
^~~~~~~~~
drivers/gpu/drm/i915/display/intel_bios.c:2045:6: note: in expansion of macro 'WARN_ON'
if (WARN_ON(port == PORT_A) || port >= ARRAY_SIZE(port_mapping))
^~~~~~~
drivers/gpu/drm/i915/display/intel_bios.c: In function 'intel_bios_is_port_edp':
drivers/gpu/drm/i915/display/intel_bios.c:2075:4: error: 'PORT_B' undeclared (first use in this function); did you mean 'PORT_BNC'?
[PORT_B] = DVO_PORT_DPB,
^~~~~~
PORT_BNC
drivers/gpu/drm/i915/display/intel_bios.c:2075:4: error: array index in initializer not of integer type
drivers/gpu/drm/i915/display/intel_bios.c:2075:4: note: (near initialization for 'port_mapping')
drivers/gpu/drm/i915/display/intel_bios.c:2076:4: error: 'PORT_C' undeclared (first use in this function); did you mean 'PORT_B'?
[PORT_C] = DVO_PORT_DPC,
^~~~~~
PORT_B
drivers/gpu/drm/i915/display/intel_bios.c:2076:4: error: array index in initializer not of integer type
drivers/gpu/drm/i915/display/intel_bios.c:2076:4: note: (near initialization for 'port_mapping')
drivers/gpu/drm/i915/display/intel_bios.c:2077:4: error: 'PORT_D' undeclared (first use in this function); did you mean 'PORT_C'?
[PORT_D] = DVO_PORT_DPD,
^~~~~~
PORT_C
drivers/gpu/drm/i915/display/intel_bios.c:2077:4: error: array index in initializer not of integer type
drivers/gpu/drm/i915/display/intel_bios.c:2077:4: note: (near initialization for 'port_mapping')
drivers/gpu/drm/i915/display/intel_bios.c:2078:4: error: 'PORT_E' undeclared (first use in this function); did you mean 'PORT_D'?
[PORT_E] = DVO_PORT_DPE,
^~~~~~
PORT_D
--
drivers/gpu/drm/i915/display/intel_display.c: In function 'intel_port_to_phy':
drivers/gpu/drm/i915/display/intel_display.c:6803:38: error: 'PORT_D' undeclared (first use in this function); did you mean 'PORT_DA'?
if (IS_ELKHARTLAKE(i915) && port == PORT_D)
^~~~~~
PORT_DA
drivers/gpu/drm/i915/display/intel_display.c: In function 'intel_port_to_tc':
drivers/gpu/drm/i915/display/intel_display.c:6815:17: error: 'PORT_D' undeclared (first use in this function); did you mean 'PORT_DA'?
return port - PORT_D;
^~~~~~
PORT_DA
drivers/gpu/drm/i915/display/intel_display.c:6817:16: error: 'PORT_C' undeclared (first use in this function); did you mean 'PORT_D'?
return port - PORT_C;
^~~~~~
PORT_D
drivers/gpu/drm/i915/display/intel_display.c: In function 'intel_port_to_power_domain':
drivers/gpu/drm/i915/display/intel_display.c:6823:7: error: 'PORT_A' undeclared (first use in this function); did you mean 'PORT_DA'?
case PORT_A:
^~~~~~
PORT_DA
drivers/gpu/drm/i915/display/intel_display.c:6825:7: error: 'PORT_B' undeclared (first use in this function); did you mean 'PORT_A'?
case PORT_B:
^~~~~~
PORT_A
drivers/gpu/drm/i915/display/intel_display.c:6827:7: error: 'PORT_C' undeclared (first use in this function); did you mean 'PORT_B'?
case PORT_C:
^~~~~~
PORT_B
drivers/gpu/drm/i915/display/intel_display.c:6829:7: error: 'PORT_D' undeclared (first use in this function); did you mean 'PORT_C'?
case PORT_D:
^~~~~~
PORT_C
drivers/gpu/drm/i915/display/intel_display.c:6831:7: error: 'PORT_E' undeclared (first use in this function); did you mean 'PORT_D'?
case PORT_E:
^~~~~~
PORT_D
drivers/gpu/drm/i915/display/intel_display.c:6833:7: error: 'PORT_F' undeclared (first use in this function); did you mean 'PORT_E'?
case PORT_F:
^~~~~~
PORT_E
drivers/gpu/drm/i915/display/intel_display.c:6835:7: error: 'PORT_G' undeclared (first use in this function); did you mean 'PORT_F'?
case PORT_G:
^~~~~~
PORT_F
drivers/gpu/drm/i915/display/intel_display.c: In function 'ironlake_init_pch_refclk':
drivers/gpu/drm/i915/display/intel_display.c:9020:25: error: 'PORT_A' undeclared (first use in this function); did you mean 'PORT_DA'?
if (encoder->port == PORT_A)
^~~~~~
PORT_DA
In file included from drivers/gpu/drm/i915/display/intel_crt.h:9:0,
from drivers/gpu/drm/i915/display/intel_display.c:46:
drivers/gpu/drm/i915/display/intel_display.c: In function 'cannonlake_get_ddi_pll':
drivers/gpu/drm/i915/i915_reg.h:10005:59: error: 'PORT_F' undeclared (first use in this function); did you mean 'PORT_DA'?
#define DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(port) ((port) == PORT_F ? 21 : \
^
drivers/gpu/drm/i915/i915_reg.h:10007:53: note: in expansion of macro 'DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT'
#define DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(port) (3 << DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(port))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/display/intel_display.c:10217:36: note: in expansion of macro 'DPCLKA_CFGCR0_DDI_CLK_SEL_MASK'
temp = I915_READ(DPCLKA_CFGCR0) & DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(port);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/display/intel_display.c: In function 'bxt_get_ddi_pll':
drivers/gpu/drm/i915/display/intel_display.c:10270:7: error: 'PORT_A' undeclared (first use in this function); did you mean 'PORT_DA'?
case PORT_A:
^~~~~~
PORT_DA
drivers/gpu/drm/i915/display/intel_display.c:10273:7: error: 'PORT_B' undeclared (first use in this function); did you mean 'PORT_A'?
case PORT_B:
^~~~~~
PORT_A
drivers/gpu/drm/i915/display/intel_display.c:10276:7: error: 'PORT_C' undeclared (first use in this function); did you mean 'PORT_B'?
case PORT_C:
^~~~~~
PORT_B
In file included from drivers/gpu/drm/i915/display/intel_ddi.h:11:0,
from drivers/gpu/drm/i915/display/intel_display.c:47:
drivers/gpu/drm/i915/display/intel_display.c: In function 'bxt_get_dsi_transcoder_state':
drivers/gpu/drm/i915/display/intel_display.h:336:18: error: 'PORT_A' undeclared (first use in this function); did you mean 'PORT_DA'?
for ((__port) = PORT_A; (__port) < I915_MAX_PORTS; (__port)++) \
^
drivers/gpu/drm/i915/display/intel_display.c:10448:2: note: in expansion of macro 'for_each_port_masked'
for_each_port_masked(port, BIT(PORT_A) | BIT(PORT_C)) {
^~~~~~~~~~~~~~~~~~~~
In file included from include/drm/drm_connector.h:31:0,
from include/drm/drm_modes.h:33,
from include/drm/drm_crtc.h:40,
from include/drm/drm_atomic.h:31,
from drivers/gpu/drm/i915/display/intel_display.c:35:
drivers/gpu/drm/i915/display/intel_display.c:10448:47: error: 'PORT_C' undeclared (first use in this function); did you mean 'PORT_A'?
for_each_port_masked(port, BIT(PORT_A) | BIT(PORT_C)) {
^
include/drm/drm_util.h:63:38: note: in definition of macro 'for_each_if'
#define for_each_if(condition) if (!(condition)) {} else
^~~~~~~~~
drivers/gpu/drm/i915/display/intel_display.c:10448:2: note: in expansion of macro 'for_each_port_masked'
for_each_port_masked(port, BIT(PORT_A) | BIT(PORT_C)) {
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/display/intel_display.c:10448:43: note: in expansion of macro 'BIT'
for_each_port_masked(port, BIT(PORT_A) | BIT(PORT_C)) {
^~~
drivers/gpu/drm/i915/display/intel_display.c: In function 'haswell_get_ddi_port_state':
>> drivers/gpu/drm/i915/display/intel_display.c:10528:15: error: 'PORT_E' undeclared (first use in this function); did you mean 'PORT_DA'?
(port == PORT_E) && I915_READ(LPT_TRANSCONF) & TRANS_ENABLE) {
^~~~~~
PORT_DA
In file included from drivers/gpu/drm/i915/display/intel_display_types.h:46:0,
from drivers/gpu/drm/i915/display/intel_dsi.h:30,
from drivers/gpu/drm/i915/display/intel_display.c:49:
drivers/gpu/drm/i915/display/intel_display.c: In function 'intel_ddi_crt_present':
drivers/gpu/drm/i915/display/intel_display.c:15884:28: error: 'PORT_A' undeclared (first use in this function); did you mean 'PORT_DA'?
if (I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES)
^
drivers/gpu/drm/i915/i915_drv.h:1981:45: note: in definition of macro '__I915_REG_OP'
intel_uncore_##op__(&(dev_priv__)->uncore, __VA_ARGS__)
^~~~~~~~~~~
drivers/gpu/drm/i915/display/intel_display.c:15884:6: note: in expansion of macro 'I915_READ'
if (I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES)
^~~~~~~~~
drivers/gpu/drm/i915/i915_reg.h:237:33: note: in expansion of macro '_MMIO'
#define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
^~~~~
drivers/gpu/drm/i915/i915_reg.h:231:28: note: in expansion of macro '_PICK_EVEN'
#define _PORT(port, a, b) _PICK_EVEN(port, a, b)
^~~~~~~~~~
drivers/gpu/drm/i915/i915_reg.h:237:39: note: in expansion of macro '_PORT'
#define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
^~~~~
drivers/gpu/drm/i915/i915_reg.h:9745:27: note: in expansion of macro '_MMIO_PORT'
#define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, _DDI_BUF_CTL_B)
^~~~~~~~~~
drivers/gpu/drm/i915/display/intel_display.c:15884:16: note: in expansion of macro 'DDI_BUF_CTL'
if (I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES)
^~~~~~~~~~~
drivers/gpu/drm/i915/display/intel_display.c: In function 'intel_setup_outputs':
drivers/gpu/drm/i915/display/intel_display.c:15940:28: error: 'PORT_A' undeclared (first use in this function); did you mean 'PORT_DA'?
intel_ddi_init(dev_priv, PORT_A);
^~~~~~
PORT_DA
drivers/gpu/drm/i915/display/intel_display.c:15941:28: error: 'PORT_B' undeclared (first use in this function); did you mean 'PORT_A'?
intel_ddi_init(dev_priv, PORT_B);
^~~~~~
PORT_A
drivers/gpu/drm/i915/display/intel_display.c:15942:28: error: 'PORT_D' undeclared (first use in this function); did you mean 'PORT_B'?
intel_ddi_init(dev_priv, PORT_D);
^~~~~~
PORT_B
drivers/gpu/drm/i915/display/intel_display.c:15943:28: error: 'PORT_E' undeclared (first use in this function); did you mean 'PORT_D'?
intel_ddi_init(dev_priv, PORT_E);
^~~~~~
PORT_D
drivers/gpu/drm/i915/display/intel_display.c:15944:28: error: 'PORT_F' undeclared (first use in this function); did you mean 'PORT_E'?
intel_ddi_init(dev_priv, PORT_F);
^~~~~~
PORT_E
drivers/gpu/drm/i915/display/intel_display.c:15945:28: error: 'PORT_G' undeclared (first use in this function); did you mean 'PORT_F'?
intel_ddi_init(dev_priv, PORT_G);
^~~~~~
PORT_F
drivers/gpu/drm/i915/display/intel_display.c:15946:28: error: 'PORT_H' undeclared (first use in this function); did you mean 'PORT_G'?
intel_ddi_init(dev_priv, PORT_H);
^~~~~~
PORT_G
drivers/gpu/drm/i915/display/intel_display.c:15947:28: error: 'PORT_I' undeclared (first use in this function); did you mean 'PORT_H'?
intel_ddi_init(dev_priv, PORT_I);
^~~~~~
PORT_H
drivers/gpu/drm/i915/display/intel_display.c:15952:28: error: 'PORT_C' undeclared (first use in this function); did you mean 'PORT_I'?
intel_ddi_init(dev_priv, PORT_C);
^~~~~~
PORT_I
drivers/gpu/drm/i915/display/intel_display.c: In function 'ibx_sanitize_pch_ports':
drivers/gpu/drm/i915/display/intel_display.c:17557:37: error: 'PORT_B' undeclared (first use in this function); did you mean 'PORT_BNC'?
ibx_sanitize_pch_dp_port(dev_priv, PORT_B, PCH_DP_B);
^~~~~~
PORT_BNC
drivers/gpu/drm/i915/display/intel_display.c:17558:37: error: 'PORT_C' undeclared (first use in this function); did you mean 'PORT_B'?
ibx_sanitize_pch_dp_port(dev_priv, PORT_C, PCH_DP_C);
^~~~~~
PORT_B
drivers/gpu/drm/i915/display/intel_display.c:17559:37: error: 'PORT_D' undeclared (first use in this function); did you mean 'PORT_C'?
ibx_sanitize_pch_dp_port(dev_priv, PORT_D, PCH_DP_D);
^~~~~~
PORT_C
drivers/gpu/drm/i915/display/intel_display.c: In function 'intel_port_to_tc':
drivers/gpu/drm/i915/display/intel_display.c:6818:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
..
vim +1482 drivers/gpu/drm/i915/display/intel_bios.c
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1419
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1420 static void parse_ddi_port(struct drm_i915_private *dev_priv,
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1421 const struct child_device_config *child,
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1422 u8 bdb_version)
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1423 {
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1424 struct ddi_vbt_port_info *info;
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1425 bool is_dvi, is_hdmi, is_dp, is_edp, is_crt;
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1426 enum port port;
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1427
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1428 port = dvo_port_to_port(child->dvo_port);
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1429 if (port == PORT_NONE)
6acab15a7b0d27 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1430 return;
6acab15a7b0d27 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1431
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1432 info = &dev_priv->vbt.ddi_port_info[port];
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1433
7679f9b8f6ee39 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-05-31 1434 if (info->child) {
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1435 DRM_DEBUG_KMS("More than one child device for port %c in VBT, using the first.\n",
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1436 port_name(port));
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1437 return;
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1438 }
b024ab9b2d3aa1 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-03-22 1439
cc9985893aacc3 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2017-08-24 1440 is_dvi = child->device_type & DEVICE_TYPE_TMDS_DVI_SIGNALING;
cc9985893aacc3 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2017-08-24 1441 is_dp = child->device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT;
cc9985893aacc3 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2017-08-24 1442 is_crt = child->device_type & DEVICE_TYPE_ANALOG_OUTPUT;
cc9985893aacc3 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2017-08-24 1443 is_hdmi = is_dvi && (child->device_type & DEVICE_TYPE_NOT_HDMI_OUTPUT) == 0;
cc9985893aacc3 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2017-08-24 1444 is_edp = is_dp && (child->device_type & DEVICE_TYPE_INTERNAL_CONNECTOR);
554d6af50a4012 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1445
2ba7d7e0437127 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2017-09-21 @1446 if (port == PORT_A && is_dvi) {
2ba7d7e0437127 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2017-09-21 1447 DRM_DEBUG_KMS("VBT claims port A supports DVI%s, ignoring\n",
2ba7d7e0437127 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2017-09-21 1448 is_hdmi ? "/HDMI" : "");
2ba7d7e0437127 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2017-09-21 1449 is_dvi = false;
2ba7d7e0437127 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2017-09-21 1450 is_hdmi = false;
2ba7d7e0437127 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2017-09-21 1451 }
2ba7d7e0437127 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2017-09-21 1452
311a20949f047a drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1453 info->supports_dvi = is_dvi;
311a20949f047a drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1454 info->supports_hdmi = is_hdmi;
311a20949f047a drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1455 info->supports_dp = is_dp;
a98d9c1d7e9bb0 drivers/gpu/drm/i915/intel_bios.c Imre Deak 2016-12-21 1456 info->supports_edp = is_edp;
311a20949f047a drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1457
38b3416f3c2f1d drivers/gpu/drm/i915/intel_bios.c Imre Deak 2018-12-14 1458 if (bdb_version >= 195)
38b3416f3c2f1d drivers/gpu/drm/i915/intel_bios.c Imre Deak 2018-12-14 1459 info->supports_typec_usb = child->dp_usb_type_c;
38b3416f3c2f1d drivers/gpu/drm/i915/intel_bios.c Imre Deak 2018-12-14 1460
38b3416f3c2f1d drivers/gpu/drm/i915/intel_bios.c Imre Deak 2018-12-14 1461 if (bdb_version >= 209)
38b3416f3c2f1d drivers/gpu/drm/i915/intel_bios.c Imre Deak 2018-12-14 1462 info->supports_tbt = child->tbt;
38b3416f3c2f1d drivers/gpu/drm/i915/intel_bios.c Imre Deak 2018-12-14 1463
932cd15431567c drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-05-31 1464 DRM_DEBUG_KMS("Port %c VBT info: CRT:%d DVI:%d HDMI:%d DP:%d eDP:%d LSPCON:%d USB-Type-C:%d TBT:%d\n",
932cd15431567c drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-05-31 1465 port_name(port), is_crt, is_dvi, is_hdmi, is_dp, is_edp,
932cd15431567c drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-05-31 1466 HAS_LSPCON(dev_priv) && child->lspcon,
38b3416f3c2f1d drivers/gpu/drm/i915/intel_bios.c Imre Deak 2018-12-14 1467 info->supports_typec_usb, info->supports_tbt);
554d6af50a4012 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1468
554d6af50a4012 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1469 if (is_edp && is_dvi)
554d6af50a4012 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1470 DRM_DEBUG_KMS("Internal DP port %c is TMDS compatible\n",
554d6af50a4012 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1471 port_name(port));
554d6af50a4012 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1472 if (is_crt && port != PORT_E)
554d6af50a4012 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1473 DRM_DEBUG_KMS("Port %c is analog\n", port_name(port));
554d6af50a4012 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1474 if (is_crt && (is_dvi || is_dp))
554d6af50a4012 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1475 DRM_DEBUG_KMS("Analog port %c is also DP or TMDS compatible\n",
554d6af50a4012 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1476 port_name(port));
554d6af50a4012 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1477 if (is_dvi && (port == PORT_A || port == PORT_E))
9b13494c916dc0 drivers/gpu/drm/i915/intel_bios.c Masanari Iida 2014-08-06 1478 DRM_DEBUG_KMS("Port %c is TMDS compatible\n", port_name(port));
554d6af50a4012 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1479 if (!is_dvi && !is_dp && !is_crt)
554d6af50a4012 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1480 DRM_DEBUG_KMS("Port %c is not DP/TMDS/CRT compatible\n",
554d6af50a4012 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1481 port_name(port));
554d6af50a4012 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 @1482 if (is_edp && (port == PORT_B || port == PORT_C || port == PORT_E))
554d6af50a4012 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1483 DRM_DEBUG_KMS("Port %c is internal DP\n", port_name(port));
6bf19e7c548d46 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1484
6bf19e7c548d46 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1485 if (is_dvi) {
e53a1058395435 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-04-11 1486 u8 ddc_pin;
e53a1058395435 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-04-11 1487
f212bf9abe5de9 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-04-11 1488 ddc_pin = map_ddc_pin(dev_priv, child->ddc_pin);
f212bf9abe5de9 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-04-11 1489 if (intel_gmbus_is_valid_pin(dev_priv, ddc_pin)) {
f212bf9abe5de9 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-04-11 1490 info->alternate_ddc_pin = ddc_pin;
9454fa871edf15 drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2016-10-11 1491 sanitize_ddc_pin(dev_priv, port);
f212bf9abe5de9 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-04-11 1492 } else {
f212bf9abe5de9 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-04-11 1493 DRM_DEBUG_KMS("Port %c has invalid DDC pin %d, "
f212bf9abe5de9 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-04-11 1494 "sticking to defaults\n",
f212bf9abe5de9 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-04-11 1495 port_name(port), ddc_pin);
f212bf9abe5de9 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-04-11 1496 }
6bf19e7c548d46 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1497 }
6bf19e7c548d46 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1498
6bf19e7c548d46 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1499 if (is_dp) {
e53a1058395435 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-04-11 1500 info->alternate_aux_channel = child->aux_channel;
9454fa871edf15 drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2016-10-11 1501
9454fa871edf15 drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2016-10-11 1502 sanitize_aux_ch(dev_priv, port);
6bf19e7c548d46 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1503 }
6bf19e7c548d46 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1504
0ead5f81d4200b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2017-09-28 1505 if (bdb_version >= 158) {
6acab15a7b0d27 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1506 /* The VBT HDMI level shift values match the table we have. */
e53a1058395435 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-04-11 1507 u8 hdmi_level_shift = child->hdmi_level_shifter_value;
6acab15a7b0d27 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1508 DRM_DEBUG_KMS("VBT HDMI level shift for port %c: %d\n",
6acab15a7b0d27 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1509 port_name(port),
6acab15a7b0d27 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1510 hdmi_level_shift);
6acab15a7b0d27 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1511 info->hdmi_level_shift = hdmi_level_shift;
6acab15a7b0d27 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1512 }
75067ddecf2127 drivers/gpu/drm/i915/intel_bios.c Antti Koskipaa 2015-07-10 1513
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1514 if (bdb_version >= 204) {
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1515 int max_tmds_clock;
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1516
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1517 switch (child->hdmi_max_data_rate) {
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1518 default:
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1519 MISSING_CASE(child->hdmi_max_data_rate);
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1520 /* fall through */
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1521 case HDMI_MAX_DATA_RATE_PLATFORM:
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1522 max_tmds_clock = 0;
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1523 break;
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1524 case HDMI_MAX_DATA_RATE_297:
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1525 max_tmds_clock = 297000;
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1526 break;
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1527 case HDMI_MAX_DATA_RATE_165:
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1528 max_tmds_clock = 165000;
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1529 break;
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1530 }
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1531
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1532 if (max_tmds_clock)
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1533 DRM_DEBUG_KMS("VBT HDMI max TMDS clock for port %c: %d kHz\n",
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1534 port_name(port), max_tmds_clock);
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1535 info->max_tmds_clock = max_tmds_clock;
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1536 }
d6038611aa3d7d drivers/gpu/drm/i915/intel_bios.c Ville Syrj?l? 2017-10-30 1537
75067ddecf2127 drivers/gpu/drm/i915/intel_bios.c Antti Koskipaa 2015-07-10 1538 /* Parse the I_boost config for SKL and above */
0ead5f81d4200b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2017-09-28 1539 if (bdb_version >= 196 && child->iboost) {
f22bb35856ba1e drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2017-08-25 1540 info->dp_boost_level = translate_iboost(child->dp_iboost_level);
75067ddecf2127 drivers/gpu/drm/i915/intel_bios.c Antti Koskipaa 2015-07-10 1541 DRM_DEBUG_KMS("VBT (e)DP boost level for port %c: %d\n",
75067ddecf2127 drivers/gpu/drm/i915/intel_bios.c Antti Koskipaa 2015-07-10 1542 port_name(port), info->dp_boost_level);
f22bb35856ba1e drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2017-08-25 1543 info->hdmi_boost_level = translate_iboost(child->hdmi_iboost_level);
75067ddecf2127 drivers/gpu/drm/i915/intel_bios.c Antti Koskipaa 2015-07-10 1544 DRM_DEBUG_KMS("VBT HDMI boost level for port %c: %d\n",
75067ddecf2127 drivers/gpu/drm/i915/intel_bios.c Antti Koskipaa 2015-07-10 1545 port_name(port), info->hdmi_boost_level);
75067ddecf2127 drivers/gpu/drm/i915/intel_bios.c Antti Koskipaa 2015-07-10 1546 }
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1547
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1548 /* DP max link rate for CNL+ */
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1549 if (bdb_version >= 216) {
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1550 switch (child->dp_max_link_rate) {
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1551 default:
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1552 case VBT_DP_MAX_LINK_RATE_HBR3:
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1553 info->dp_max_link_rate = 810000;
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1554 break;
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1555 case VBT_DP_MAX_LINK_RATE_HBR2:
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1556 info->dp_max_link_rate = 540000;
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1557 break;
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1558 case VBT_DP_MAX_LINK_RATE_HBR:
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1559 info->dp_max_link_rate = 270000;
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1560 break;
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1561 case VBT_DP_MAX_LINK_RATE_LBR:
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1562 info->dp_max_link_rate = 162000;
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1563 break;
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1564 }
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1565 DRM_DEBUG_KMS("VBT DP max link rate for port %c: %d\n",
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1566 port_name(port), info->dp_max_link_rate);
99b91bda84060b drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2018-02-01 1567 }
7679f9b8f6ee39 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-05-31 1568
7679f9b8f6ee39 drivers/gpu/drm/i915/intel_bios.c Jani Nikula 2019-05-31 1569 info->child = child;
6acab15a7b0d27 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1570 }
6acab15a7b0d27 drivers/gpu/drm/i915/intel_bios.c Paulo Zanoni 2013-09-12 1571
:::::: The code at line 1482 was first introduced by commit
:::::: 554d6af50a40125c28e4e1035527a684d2607266 drm/i915: add some assertions about VBT DDI port types
:::::: TO: Paulo Zanoni <[email protected]>
:::::: CC: Daniel Vetter <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/[email protected] Intel Corporation
On 1/31/2020 7:34 AM, Calvin Johnson wrote:
> From: Calvin Johnson <[email protected]>
>
> Add ACPI support for MDIO bus registration while maintaining
> the existing DT support.
>
> Signed-off-by: Calvin Johnson <[email protected]>
> ---
[snip]
> bus = mdiobus_alloc_size(sizeof(struct mdio_fsl_priv));
> @@ -263,25 +265,41 @@ static int xgmac_mdio_probe(struct platform_device *pdev)
> bus->read = xgmac_mdio_read;
> bus->write = xgmac_mdio_write;
> bus->parent = &pdev->dev;
> - snprintf(bus->id, MII_BUS_ID_SIZE, "%llx", (unsigned long long)res.start);
> + snprintf(bus->id, MII_BUS_ID_SIZE, "%llx",
> + (unsigned long long)res->start);
You could omit this clean up change.
>
> /* Set the PHY base address */
> priv = bus->priv;
> - priv->mdio_base = of_iomap(np, 0);
> + priv->mdio_base = devm_ioremap_resource(&pdev->dev, res);
> if (!priv->mdio_base) {
This probably needs to become IS_ERR() instead of a plain NULL check
> ret = -ENOMEM;
> goto err_ioremap;
> }
>
> - priv->is_little_endian = of_property_read_bool(pdev->dev.of_node,
> - "little-endian");
> -
> - priv->has_a011043 = of_property_read_bool(pdev->dev.of_node,
> - "fsl,erratum-a011043");
> -
> - ret = of_mdiobus_register(bus, np);
> - if (ret) {
> - dev_err(&pdev->dev, "cannot register MDIO bus\n");
> + if (is_of_node(pdev->dev.fwnode)) {
> + priv->is_little_endian = of_property_read_bool(pdev->dev.of_node,
> + "little-endian");
> +
> + priv->has_a011043 = of_property_read_bool(pdev->dev.of_node,
> + "fsl,erratum-a011043");
> +
> + ret = of_mdiobus_register(bus, np);
> + if (ret) {
> + dev_err(&pdev->dev, "cannot register MDIO bus\n");
> + goto err_registration;
> + }
> + } else if (is_acpi_node(pdev->dev.fwnode)) {
> + priv->is_little_endian =
> + fwnode_property_read_bool(pdev->dev.fwnode,
> + "little-endian");
> + ret = fwnode_mdiobus_register(bus, pdev->dev.fwnode);
> + if (ret) {
> + dev_err(&pdev->dev, "cannot register MDIO bus\n");
> + goto err_registration;
> + }
The little-endian property read can be moved out of the DT/ACPI paths
and you can just use device_property_read_bool() for that purpose.
Having both fwnode_mdiobus_register() and of_mdiobus_register() looks
fairly redundant, you could quite easily introduce a wrapper:
device_mdiobus_register() which internally takes the appropriate DT/ACPI
paths as needed.
--
Florian
Hi Calvin,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on v5.5]
[cannot apply to driver-core/driver-core-testing net-next/master net/master linus/master sparc-next/master next-20200203]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Calvin-Johnson/ACPI-support-for-xgmac_mdio-and-dpaa2-mac-drivers/20200203-070754
base: d5226fa6dbae0569ee43ecfc08bdcd6770fc4755
config: sparc64-randconfig-a001-20200203 (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=sparc64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email protected]>
All errors (new ones prefixed by >>):
include/linux/phy.h: In function 'phy_ethtool_get_stats':
include/linux/phy.h:1260:22: error: 'struct phy_device' has no member named 'lock'; did you mean 'link'?
mutex_lock(&phydev->lock);
^
include/linux/mutex.h:153:44: note: in definition of macro 'mutex_lock'
#define mutex_lock(lock) mutex_lock_nested(lock, 0)
^~~~
In file included from include/linux/property.h:16:0,
from include/linux/of.h:22,
from arch/sparc/include/asm/openprom.h:15,
from arch/sparc/include/asm/device.h:8,
from include/linux/device.h:29,
from include/linux/dma-mapping.h:7,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from net/core/ethtool.c:14:
include/linux/phy.h:1261:33: error: passing argument 2 of 'phydev->drv->get_stats' from incompatible pointer type [-Werror=incompatible-pointer-types]
phydev->drv->get_stats(phydev, stats, data);
^~~~~
include/linux/phy.h:1261:33: note: expected 'struct ethtool_stats *' but argument is of type 'struct ethtool_stats *'
include/linux/phy.h:1262:24: error: 'struct phy_device' has no member named 'lock'; did you mean 'link'?
mutex_unlock(&phydev->lock);
^~~~
link
In file included from include/linux/dma-mapping.h:7:0,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from net/core/ethtool.c:14:
include/linux/device.h: At top level:
include/linux/device.h:1370:27: error: conflicting types for 'dev_name'
static inline const char *dev_name(const struct device *dev)
^~~~~~~~
In file included from include/linux/property.h:16:0,
from include/linux/of.h:22,
from arch/sparc/include/asm/openprom.h:15,
from arch/sparc/include/asm/device.h:8,
from include/linux/device.h:29,
from include/linux/dma-mapping.h:7,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from net/core/ethtool.c:14:
include/linux/phy.h:1076:9: note: previous implicit declaration of 'dev_name' was here
return dev_name(&phydev->mdio.dev);
^~~~~~~~
In file included from include/linux/dma-mapping.h:7:0,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from net/core/ethtool.c:14:
include/linux/device.h:1417:21: error: conflicting types for 'dev_get_drvdata'
static inline void *dev_get_drvdata(const struct device *dev)
^~~~~~~~~~~~~~~
In file included from include/linux/phy.h:18:0,
from include/linux/property.h:16,
from include/linux/of.h:22,
from arch/sparc/include/asm/openprom.h:15,
from arch/sparc/include/asm/device.h:8,
from include/linux/device.h:29,
from include/linux/dma-mapping.h:7,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from net/core/ethtool.c:14:
include/linux/mdio.h:79:9: note: previous implicit declaration of 'dev_get_drvdata' was here
return dev_get_drvdata(&mdio->dev);
^~~~~~~~~~~~~~~
In file included from include/linux/dma-mapping.h:7:0,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from net/core/ethtool.c:14:
include/linux/device.h:1422:20: warning: conflicting types for 'dev_set_drvdata'
static inline void dev_set_drvdata(struct device *dev, void *data)
^~~~~~~~~~~~~~~
include/linux/device.h:1422:20: error: static declaration of 'dev_set_drvdata' follows non-static declaration
In file included from include/linux/phy.h:18:0,
from include/linux/property.h:16,
from include/linux/of.h:22,
from arch/sparc/include/asm/openprom.h:15,
from arch/sparc/include/asm/device.h:8,
from include/linux/device.h:29,
from include/linux/dma-mapping.h:7,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from net/core/ethtool.c:14:
include/linux/mdio.h:74:2: note: previous implicit declaration of 'dev_set_drvdata' was here
dev_set_drvdata(&mdio->dev, data);
^~~~~~~~~~~~~~~
net/core/ethtool.c: In function 'ethtool_get_phy_stats':
>> net/core/ethtool.c:1963:45: error: passing argument 2 of 'phy_ethtool_get_stats' from incompatible pointer type [-Werror=incompatible-pointer-types]
ret = phy_ethtool_get_stats(dev->phydev, &stats, data);
^
In file included from include/linux/property.h:16:0,
from include/linux/of.h:22,
from arch/sparc/include/asm/openprom.h:15,
from arch/sparc/include/asm/device.h:8,
from include/linux/device.h:29,
from include/linux/dma-mapping.h:7,
from include/linux/skbuff.h:31,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from net/core/ethtool.c:14:
include/linux/phy.h:1254:19: note: expected 'struct ethtool_stats *' but argument is of type 'struct ethtool_stats *'
static inline int phy_ethtool_get_stats(struct phy_device *phydev,
^~~~~~~~~~~~~~~~~~~~~
net/core/ethtool.c: In function 'ethtool_get_ts_info':
>> net/core/ethtool.c:2174:38: error: passing argument 2 of 'phydev->drv->ts_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
err = phydev->drv->ts_info(phydev, &info);
^
net/core/ethtool.c:2174:38: note: expected 'struct ethtool_ts_info *' but argument is of type 'struct ethtool_ts_info *'
net/core/ethtool.c: In function '__ethtool_get_module_info':
>> net/core/ethtool.c:2203:43: error: passing argument 2 of 'phydev->drv->module_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
return phydev->drv->module_info(phydev, modinfo);
^~~~~~~
net/core/ethtool.c:2203:43: note: expected 'struct ethtool_modinfo *' but argument is of type 'struct ethtool_modinfo *'
net/core/ethtool.c: In function '__ethtool_get_module_eeprom':
>> net/core/ethtool.c:2240:45: error: passing argument 2 of 'phydev->drv->module_eeprom' from incompatible pointer type [-Werror=incompatible-pointer-types]
return phydev->drv->module_eeprom(phydev, ee, data);
^~
net/core/ethtool.c:2240:45: note: expected 'struct ethtool_eeprom *' but argument is of type 'struct ethtool_eeprom *'
In file included from include/linux/notifier.h:14:0,
from include/linux/memory_hotplug.h:7,
from include/linux/mmzone.h:823,
from include/linux/gfp.h:6,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:16,
from net/core/ethtool.c:10:
net/core/ethtool.c: In function 'get_phy_tunable':
>> net/core/ethtool.c:2487:22: error: 'struct phy_device' has no member named 'lock'; did you mean 'link'?
mutex_lock(&phydev->lock);
^
include/linux/mutex.h:153:44: note: in definition of macro 'mutex_lock'
#define mutex_lock(lock) mutex_lock_nested(lock, 0)
^~~~
>> net/core/ethtool.c:2488:41: error: passing argument 2 of 'phydev->drv->get_tunable' from incompatible pointer type [-Werror=incompatible-pointer-types]
ret = phydev->drv->get_tunable(phydev, &tuna, data);
^
net/core/ethtool.c:2488:41: note: expected 'struct ethtool_tunable *' but argument is of type 'struct ethtool_tunable *'
net/core/ethtool.c:2489:24: error: 'struct phy_device' has no member named 'lock'; did you mean 'link'?
mutex_unlock(&phydev->lock);
^~~~
link
In file included from include/linux/notifier.h:14:0,
from include/linux/memory_hotplug.h:7,
from include/linux/mmzone.h:823,
from include/linux/gfp.h:6,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:16,
from net/core/ethtool.c:10:
net/core/ethtool.c: In function 'set_phy_tunable':
net/core/ethtool.c:2521:22: error: 'struct phy_device' has no member named 'lock'; did you mean 'link'?
mutex_lock(&phydev->lock);
^
include/linux/mutex.h:153:44: note: in definition of macro 'mutex_lock'
#define mutex_lock(lock) mutex_lock_nested(lock, 0)
^~~~
>> net/core/ethtool.c:2522:41: error: passing argument 2 of 'phydev->drv->set_tunable' from incompatible pointer type [-Werror=incompatible-pointer-types]
ret = phydev->drv->set_tunable(phydev, &tuna, data);
^
net/core/ethtool.c:2522:41: note: expected 'struct ethtool_tunable *' but argument is of type 'struct ethtool_tunable *'
net/core/ethtool.c:2523:24: error: 'struct phy_device' has no member named 'lock'; did you mean 'link'?
mutex_unlock(&phydev->lock);
^~~~
link
cc1: some warnings being treated as errors
vim +/phy_ethtool_get_stats +1963 net/core/ethtool.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 1930
f3a4094558ddf8 Andrew Lunn 2015-12-30 1931 static int ethtool_get_phy_stats(struct net_device *dev, void __user *useraddr)
f3a4094558ddf8 Andrew Lunn 2015-12-30 1932 {
9994338227179e Florian Fainelli 2018-04-25 1933 const struct ethtool_ops *ops = dev->ethtool_ops;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1934 struct phy_device *phydev = dev->phydev;
9994338227179e Florian Fainelli 2018-04-25 1935 struct ethtool_stats stats;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1936 u64 *data;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1937 int ret, n_stats;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1938
9994338227179e Florian Fainelli 2018-04-25 1939 if (!phydev && (!ops->get_ethtool_phy_stats || !ops->get_sset_count))
f3a4094558ddf8 Andrew Lunn 2015-12-30 1940 return -EOPNOTSUPP;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1941
9994338227179e Florian Fainelli 2018-04-25 1942 if (dev->phydev && !ops->get_ethtool_phy_stats)
c59530d0d5dccc Florian Fainelli 2018-04-25 1943 n_stats = phy_ethtool_get_sset_count(dev->phydev);
9994338227179e Florian Fainelli 2018-04-25 1944 else
9994338227179e Florian Fainelli 2018-04-25 1945 n_stats = ops->get_sset_count(dev, ETH_SS_PHY_STATS);
f3a4094558ddf8 Andrew Lunn 2015-12-30 1946 if (n_stats < 0)
f3a4094558ddf8 Andrew Lunn 2015-12-30 1947 return n_stats;
4d1ceea8516cd6 Alexei Starovoitov 2017-01-30 1948 if (n_stats > S32_MAX / sizeof(u64))
4d1ceea8516cd6 Alexei Starovoitov 2017-01-30 1949 return -ENOMEM;
4d1ceea8516cd6 Alexei Starovoitov 2017-01-30 1950 WARN_ON_ONCE(!n_stats);
f3a4094558ddf8 Andrew Lunn 2015-12-30 1951
f3a4094558ddf8 Andrew Lunn 2015-12-30 1952 if (copy_from_user(&stats, useraddr, sizeof(stats)))
f3a4094558ddf8 Andrew Lunn 2015-12-30 1953 return -EFAULT;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1954
f3a4094558ddf8 Andrew Lunn 2015-12-30 1955 stats.n_stats = n_stats;
3d8830266ffc28 Li RongQing 2019-03-29 1956
3d8830266ffc28 Li RongQing 2019-03-29 1957 if (n_stats) {
fad953ce0b22cf Kees Cook 2018-06-12 1958 data = vzalloc(array_size(n_stats, sizeof(u64)));
3d8830266ffc28 Li RongQing 2019-03-29 1959 if (!data)
f3a4094558ddf8 Andrew Lunn 2015-12-30 1960 return -ENOMEM;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1961
9994338227179e Florian Fainelli 2018-04-25 1962 if (dev->phydev && !ops->get_ethtool_phy_stats) {
c59530d0d5dccc Florian Fainelli 2018-04-25 @1963 ret = phy_ethtool_get_stats(dev->phydev, &stats, data);
c59530d0d5dccc Florian Fainelli 2018-04-25 1964 if (ret < 0)
3d8830266ffc28 Li RongQing 2019-03-29 1965 goto out;
9994338227179e Florian Fainelli 2018-04-25 1966 } else {
9994338227179e Florian Fainelli 2018-04-25 1967 ops->get_ethtool_phy_stats(dev, &stats, data);
9994338227179e Florian Fainelli 2018-04-25 1968 }
3d8830266ffc28 Li RongQing 2019-03-29 1969 } else {
3d8830266ffc28 Li RongQing 2019-03-29 1970 data = NULL;
3d8830266ffc28 Li RongQing 2019-03-29 1971 }
f3a4094558ddf8 Andrew Lunn 2015-12-30 1972
f3a4094558ddf8 Andrew Lunn 2015-12-30 1973 ret = -EFAULT;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1974 if (copy_to_user(useraddr, &stats, sizeof(stats)))
f3a4094558ddf8 Andrew Lunn 2015-12-30 1975 goto out;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1976 useraddr += sizeof(stats);
4d1ceea8516cd6 Alexei Starovoitov 2017-01-30 1977 if (n_stats && copy_to_user(useraddr, data, n_stats * sizeof(u64)))
f3a4094558ddf8 Andrew Lunn 2015-12-30 1978 goto out;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1979 ret = 0;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1980
f3a4094558ddf8 Andrew Lunn 2015-12-30 1981 out:
4d1ceea8516cd6 Alexei Starovoitov 2017-01-30 1982 vfree(data);
f3a4094558ddf8 Andrew Lunn 2015-12-30 1983 return ret;
f3a4094558ddf8 Andrew Lunn 2015-12-30 1984 }
f3a4094558ddf8 Andrew Lunn 2015-12-30 1985
:::::: The code at line 1963 was first introduced by commit
:::::: c59530d0d5dccc96795af12c139f618182cf98db net: Move PHY statistics code into PHY library helpers
:::::: TO: Florian Fainelli <[email protected]>
:::::: CC: David S. Miller <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/[email protected] Intel Corporation
Hi Andy,
> -----Original Message-----
> From: Andy Shevchenko <[email protected]>
> Subject: Re: [PATCH v1 4/7] device property: fwnode_get_phy_mode:
> Change API to solve int/unit warnings
>
> On Fri, Jan 31, 2020 at 5:38 PM Calvin Johnson <[email protected]>
> wrote:
> >
> > From: Calvin Johnson <[email protected]>
> >
> > API fwnode_get_phy_mode is modified to follow the changes made by
> > Commit 0c65b2b90d13c1 ("net: of_get_phy_mode: Change API to solve
> > int/unit warnings").
>
> I think it would be good to base your series on Dan's fix patch.
This patch is based on Dan's fix patch https://www.spinics.net/lists/netdev/msg606487.html .
Commit 0c65b2b90d13c1 ("net: of_get_phy_mode: Change API to solve int/unit warnings").
Can you please give more clarity on what you meant? Please point to me, if there is some
specific patch that you are referring to.
Thanks
Calvin
> -----Original Message-----
> From: Andy Shevchenko <[email protected]>
> Subject: Re: [PATCH v1 5/7] device property: Introduce
> fwnode_phy_is_fixed_link()
>
> On Fri, Jan 31, 2020 at 5:38 PM Calvin Johnson <[email protected]>
> wrote:
> >
> > From: Calvin Johnson <[email protected]>
> >
> > Introduce fwnode_phy_is_fixed_link() function that an Ethernet driver
> > can call on its PHY phandle to find out whether it's a fixed link PHY
> > or not.
>
> > +/*
> > + * fwnode_phy_is_fixed_link()
> > + */
>
> Please, do a full kernel doc description.
Sure will take care in v2.
> > +bool fwnode_phy_is_fixed_link(struct fwnode_handle *fwnode) {
> > + struct fwnode_handle *fixed_node;
> > + int len, err;
> > + const char *managed;
> > +
> > + fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
> > + if (fixed_node)
> > + return fixed_node;
> > +
> > + err = fwnode_property_read_string(fixed_node, "managed",
> > + &managed);
>
> > + if (err == 0 && strcmp(managed, "auto") != 0)
> > + return true;
> > +
> > + return false;
>
> Maybe other way around?
>
> if (err)
> return false;
>
> return !strcmp(managed, "auto");
>
> ?
>
> Same pattern perhaps for the patch where you introduce
> fwnode_get_phy_mode().
Thanks! Will take care in v2.
Regards
Calvin
On Mon, Feb 03, 2020 at 09:13:42AM +0000, Calvin Johnson (OSS) wrote:
> > -----Original Message-----
> > From: Andy Shevchenko <[email protected]>
> > Subject: Re: [PATCH v1 4/7] device property: fwnode_get_phy_mode:
> > Change API to solve int/unit warnings
> >
> > On Fri, Jan 31, 2020 at 5:38 PM Calvin Johnson <[email protected]>
> > wrote:
> > >
> > > From: Calvin Johnson <[email protected]>
> > >
> > > API fwnode_get_phy_mode is modified to follow the changes made by
> > > Commit 0c65b2b90d13c1 ("net: of_get_phy_mode: Change API to solve
> > > int/unit warnings").
> >
> > I think it would be good to base your series on Dan's fix patch.
>
> This patch is based on Dan's fix patch https://www.spinics.net/lists/netdev/msg606487.html .
> Commit 0c65b2b90d13c1 ("net: of_get_phy_mode: Change API to solve int/unit warnings").
> Can you please give more clarity on what you meant? Please point to me, if there is some
> specific patch that you are referring to.
Ah, sorry, I meant the "device property: change device_get_phy_mode() to
prevent signedess bugs" [1]. It fixes some PHY initialization issues with the
existing code (thus, should be backported).
[1]: https://lkml.org/lkml/2020/1/31/1
--
With Best Regards,
Andy Shevchenko
On 1/31/20 7:34 AM, Calvin Johnson wrote:
> From: Calvin Johnson <[email protected]>
>
> This patch series provides ACPI support for xgmac_mdio and dpaa2-mac
> driver. Most of the DT APIs are replaced with fwnode APIs to handle
> both DT and ACPI nodes.
>
> Old patch by Marcin Wojtas: (mdio_bus: Introduce fwnode MDIO helpers),
> is reused in this series to get some fwnode mdio helper APIs.
Andrew's comment on your first patch is a good summary of what this
patch series does, instead of consolidating the existing code and making
it less of_* centric and more firmware agnostic, this duplicates the
existing infrastructure almost line for line to create a fwnode specific
implementation. The preference would be for you to move away from that
and use device_* properties as much as possible while making the code
capable of handling all firmware implementations.
Can you also show a few DSDT for the devices that you are working so we
can a feeling of how you represented the various properties and
parent/child devices dependencies?
>
>
> Calvin Johnson (6):
> mdio_bus: modify fwnode phy related functions
> net/fsl: add ACPI support for mdio bus
> device property: fwnode_get_phy_mode: Change API to solve int/unit
> warnings
> device property: Introduce fwnode_phy_is_fixed_link()
> net: phylink: Introduce phylink_fwnode_phy_connect()
> dpaa2-eth: Add ACPI support for DPAA2 MAC driver
>
> Marcin Wojtas (1):
> mdio_bus: Introduce fwnode MDIO helpers
>
> drivers/base/property.c | 43 ++-
> .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 78 ++++--
> drivers/net/ethernet/freescale/xgmac_mdio.c | 63 +++--
> .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 7 +-
> drivers/net/phy/mdio_bus.c | 244 ++++++++++++++++++
> drivers/net/phy/phylink.c | 64 +++++
> include/linux/mdio.h | 3 +
> include/linux/phylink.h | 2 +
> include/linux/property.h | 5 +-
> 9 files changed, 450 insertions(+), 59 deletions(-)
>
--
Florian
Hi Calvin,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on v5.5]
[cannot apply to driver-core/driver-core-testing net-next/master net/master linus/master sparc-next/master next-20200203]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Calvin-Johnson/ACPI-support-for-xgmac_mdio-and-dpaa2-mac-drivers/20200203-070754
base: d5226fa6dbae0569ee43ecfc08bdcd6770fc4755
reproduce: make htmldocs
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email protected]>
All warnings (new ones prefixed by >>):
Warning: The Sphinx 'sphinx_rtd_theme' HTML theme was not found. Make sure you have the theme installed to produce pretty HTML output. Falling back to the default theme.
WARNING: dot(1) not found, for better output quality install graphviz from http://www.graphviz.org
WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org)
include/linux/spi/spi.h:207: warning: Function parameter or member 'driver_override' not described in 'spi_device'
include/linux/spi/spi.h:650: warning: Function parameter or member 'irq_flags' not described in 'spi_controller'
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c:1: warning: no structured comments found
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1: warning: no structured comments found
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:254: warning: Function parameter or member 'hdcp_workqueue' not described in 'amdgpu_display_manager'
include/linux/lsm_hooks.h:1830: warning: Function parameter or member 'quotactl' not described in 'security_list_options'
include/linux/lsm_hooks.h:1830: warning: Function parameter or member 'quota_on' not described in 'security_list_options'
include/linux/lsm_hooks.h:1830: warning: Function parameter or member 'sb_free_mnt_opts' not described in 'security_list_options'
include/linux/lsm_hooks.h:1830: warning: Function parameter or member 'sb_eat_lsm_opts' not described in 'security_list_options'
include/linux/lsm_hooks.h:1830: warning: Function parameter or member 'sb_kern_mount' not described in 'security_list_options'
include/linux/lsm_hooks.h:1830: warning: Function parameter or member 'sb_show_options' not described in 'security_list_options'
include/linux/lsm_hooks.h:1830: warning: Function parameter or member 'sb_add_mnt_opt' not described in 'security_list_options'
include/linux/lsm_hooks.h:1830: warning: Function parameter or member 'd_instantiate' not described in 'security_list_options'
include/linux/lsm_hooks.h:1830: warning: Function parameter or member 'getprocattr' not described in 'security_list_options'
include/linux/lsm_hooks.h:1830: warning: Function parameter or member 'setprocattr' not described in 'security_list_options'
include/linux/lsm_hooks.h:1830: warning: Function parameter or member 'locked_down' not described in 'security_list_options'
include/linux/lsm_hooks.h:1830: warning: Function parameter or member 'perf_event_open' not described in 'security_list_options'
include/linux/lsm_hooks.h:1830: warning: Function parameter or member 'perf_event_alloc' not described in 'security_list_options'
include/linux/lsm_hooks.h:1830: warning: Function parameter or member 'perf_event_free' not described in 'security_list_options'
include/linux/lsm_hooks.h:1830: warning: Function parameter or member 'perf_event_read' not described in 'security_list_options'
include/linux/lsm_hooks.h:1830: warning: Function parameter or member 'perf_event_write' not described in 'security_list_options'
drivers/usb/typec/bus.c:1: warning: 'typec_altmode_register_driver' not found
drivers/usb/typec/bus.c:1: warning: 'typec_altmode_unregister_driver' not found
drivers/usb/typec/class.c:1: warning: 'typec_altmode_register_notifier' not found
drivers/usb/typec/class.c:1: warning: 'typec_altmode_unregister_notifier' not found
include/linux/regulator/machine.h:196: warning: Function parameter or member 'max_uV_step' not described in 'regulation_constraints'
include/linux/regulator/driver.h:223: warning: Function parameter or member 'resume' not described in 'regulator_ops'
sound/soc/soc-core.c:2522: warning: Function parameter or member 'legacy_dai_naming' not described in 'snd_soc_register_dai'
include/linux/skbuff.h:888: warning: Function parameter or member 'dev_scratch' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'list' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'ip_defrag_offset' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'skb_mstamp_ns' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member '__cloned_offset' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'head_frag' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member '__pkt_type_offset' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'encapsulation' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'encap_hdr_csum' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'csum_valid' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member '__pkt_vlan_present_offset' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'vlan_present' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'csum_complete_sw' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'csum_level' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'inner_protocol_type' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'remcsum_offload' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'sender_cpu' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'reserved_tailroom' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'inner_ipproto' not described in 'sk_buff'
include/net/sock.h:232: warning: Function parameter or member 'skc_addrpair' not described in 'sock_common'
include/net/sock.h:232: warning: Function parameter or member 'skc_portpair' not described in 'sock_common'
include/net/sock.h:232: warning: Function parameter or member 'skc_ipv6only' not described in 'sock_common'
include/net/sock.h:232: warning: Function parameter or member 'skc_net_refcnt' not described in 'sock_common'
include/net/sock.h:232: warning: Function parameter or member 'skc_v6_daddr' not described in 'sock_common'
include/net/sock.h:232: warning: Function parameter or member 'skc_v6_rcv_saddr' not described in 'sock_common'
include/net/sock.h:232: warning: Function parameter or member 'skc_cookie' not described in 'sock_common'
include/net/sock.h:232: warning: Function parameter or member 'skc_listener' not described in 'sock_common'
include/net/sock.h:232: warning: Function parameter or member 'skc_tw_dr' not described in 'sock_common'
include/net/sock.h:232: warning: Function parameter or member 'skc_rcv_wnd' not described in 'sock_common'
include/net/sock.h:232: warning: Function parameter or member 'skc_tw_rcv_nxt' not described in 'sock_common'
include/net/sock.h:514: warning: Function parameter or member 'sk_rx_skb_cache' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'sk_wq_raw' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'tcp_rtx_queue' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'sk_tx_skb_cache' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'sk_route_forced_caps' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'sk_txtime_report_errors' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'sk_validate_xmit_skb' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'sk_bpf_storage' not described in 'sock'
include/net/sock.h:2459: warning: Function parameter or member 'tcp_rx_skb_cache_key' not described in 'DECLARE_STATIC_KEY_FALSE'
include/net/sock.h:2459: warning: Excess function parameter 'sk' description in 'DECLARE_STATIC_KEY_FALSE'
include/net/sock.h:2459: warning: Excess function parameter 'skb' description in 'DECLARE_STATIC_KEY_FALSE'
net/core/skbuff.c:5489: warning: Function parameter or member 'ethernet' not described in 'skb_mpls_push'
include/linux/netdevice.h:2082: warning: Function parameter or member 'gso_partial_features' not described in 'net_device'
include/linux/netdevice.h:2082: warning: Function parameter or member 'l3mdev_ops' not described in 'net_device'
include/linux/netdevice.h:2082: warning: Function parameter or member 'xfrmdev_ops' not described in 'net_device'
include/linux/netdevice.h:2082: warning: Function parameter or member 'tlsdev_ops' not described in 'net_device'
include/linux/netdevice.h:2082: warning: Function parameter or member 'name_assign_type' not described in 'net_device'
include/linux/netdevice.h:2082: warning: Function parameter or member 'ieee802154_ptr' not described in 'net_device'
include/linux/netdevice.h:2082: warning: Function parameter or member 'mpls_ptr' not described in 'net_device'
include/linux/netdevice.h:2082: warning: Function parameter or member 'xdp_prog' not described in 'net_device'
include/linux/netdevice.h:2082: warning: Function parameter or member 'gro_flush_timeout' not described in 'net_device'
include/linux/netdevice.h:2082: warning: Function parameter or member 'nf_hooks_ingress' not described in 'net_device'
include/linux/netdevice.h:2082: warning: Function parameter or member 'qdisc_hash' not described in 'net_device'
include/linux/netdevice.h:2082: warning: Function parameter or member 'xps_cpus_map' not described in 'net_device'
include/linux/netdevice.h:2082: warning: Function parameter or member 'xps_rxqs_map' not described in 'net_device'
drivers/net/phy/mdio_bus.c:861: warning: Function parameter or member 'child' not described in 'fwnode_mdiobus_child_is_phy'
include/linux/phylink.h:56: warning: Function parameter or member '__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising' not described in 'phylink_link_state'
include/linux/phylink.h:56: warning: Function parameter or member '__ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising' not described in 'phylink_link_state'
>> drivers/net/phy/phylink.c:836: warning: Function parameter or member 'fwnode' not described in 'phylink_fwnode_phy_connect'
drivers/net/phy/phylink.c:836: warning: Excess function parameter 'dn' description in 'phylink_fwnode_phy_connect'
drivers/infiniband/core/umem_odp.c:167: warning: Function parameter or member 'ops' not described in 'ib_umem_odp_alloc_child'
drivers/infiniband/core/umem_odp.c:217: warning: Function parameter or member 'ops' not described in 'ib_umem_odp_get'
drivers/infiniband/ulp/iser/iscsi_iser.h:401: warning: Function parameter or member 'all_list' not described in 'iser_fr_desc'
drivers/infiniband/ulp/iser/iscsi_iser.h:415: warning: Function parameter or member 'all_list' not described in 'iser_fr_pool'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd0' not described in 'opa_vesw_info'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd1' not described in 'opa_vesw_info'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd2' not described in 'opa_vesw_info'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd3' not described in 'opa_vesw_info'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd4' not described in 'opa_vesw_info'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:205: warning: Function parameter or member 'rsvd0' not described in 'opa_per_veswport_info'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:205: warning: Function parameter or member 'rsvd1' not described in 'opa_per_veswport_info'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:205: warning: Function parameter or member 'rsvd2' not described in 'opa_per_veswport_info'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:205: warning: Function parameter or member 'rsvd3' not described in 'opa_per_veswport_info'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:263: warning: Function parameter or member 'tbl_entries' not described in 'opa_veswport_mactable'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:342: warning: Function parameter or member 'reserved' not described in 'opa_veswport_summary_counters'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd0' not described in 'opa_veswport_error_counters'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd1' not described in 'opa_veswport_error_counters'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd2' not described in 'opa_veswport_error_counters'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd3' not described in 'opa_veswport_error_counters'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd4' not described in 'opa_veswport_error_counters'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd5' not described in 'opa_veswport_error_counters'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd6' not described in 'opa_veswport_error_counters'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd7' not described in 'opa_veswport_error_counters'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd8' not described in 'opa_veswport_error_counters'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd9' not described in 'opa_veswport_error_counters'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:460: warning: Function parameter or member 'reserved' not described in 'opa_vnic_vema_mad'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:485: warning: Function parameter or member 'reserved' not described in 'opa_vnic_notice_attr'
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:500: warning: Function parameter or member 'reserved' not described in 'opa_vnic_vema_mad_trap'
include/linux/input/sparse-keymap.h:43: warning: Function parameter or member 'sw' not described in 'key_entry'
include/drm/drm_modeset_helper_vtables.h:1052: warning: Function parameter or member 'prepare_writeback_job' not described in 'drm_connector_helper_funcs'
include/drm/drm_modeset_helper_vtables.h:1052: warning: Function parameter or member 'cleanup_writeback_job' not described in 'drm_connector_helper_funcs'
include/net/cfg80211.h:1189: warning: Function parameter or member 'txpwr' not described in 'station_parameters'
include/net/mac80211.h:4081: warning: Function parameter or member 'sta_set_txpwr' not described in 'ieee80211_ops'
include/net/mac80211.h:2036: warning: Function parameter or member 'txpwr' not described in 'ieee80211_sta'
include/linux/devfreq.h:187: warning: Function parameter or member 'last_status' not described in 'devfreq'
drivers/devfreq/devfreq.c:1818: warning: bad line: - Resource-managed devfreq_register_notifier()
drivers/devfreq/devfreq.c:1854: warning: bad line: - Resource-managed devfreq_unregister_notifier()
drivers/devfreq/devfreq-event.c:355: warning: Function parameter or member 'edev' not described in 'devfreq_event_remove_edev'
drivers/devfreq/devfreq-event.c:355: warning: Excess function parameter 'dev' description in 'devfreq_event_remove_edev'
Documentation/admin-guide/hw-vuln/tsx_async_abort.rst:142: WARNING: duplicate label virt_mechanism, other instance in Documentation/admin-guide/hw-vuln/mds.rst
Documentation/admin-guide/ras.rst:358: WARNING: Definition list ends without a blank line; unexpected unindent.
Documentation/admin-guide/ras.rst:358: WARNING: Definition list ends without a blank line; unexpected unindent.
Documentation/admin-guide/ras.rst:363: WARNING: Definition list ends without a blank line; unexpected unindent.
Documentation/admin-guide/ras.rst:363: WARNING: Definition list ends without a blank line; unexpected unindent.
Documentation/driver-api/driver-model/driver.rst:215: WARNING: Inline emphasis start-string without end-string.
Documentation/driver-api/driver-model/driver.rst:215: WARNING: Inline emphasis start-string without end-string.
include/uapi/linux/firewire-cdev.h:312: WARNING: Inline literal start-string without end-string.
drivers/firewire/core-transaction.c:606: WARNING: Inline strong start-string without end-string.
Documentation/x86/boot.rst:72: WARNING: Malformed table.
Text in column margin in table line 57.
vim +836 drivers/net/phy/phylink.c
820
821 /**
822 * phylink_fwnode_phy_connect() - connect the PHY specified in the fwnode.
823 * @pl: a pointer to a &struct phylink returned from phylink_create()
824 * @dn: a pointer to a &struct device_node.
825 * @flags: PHY-specific flags to communicate to the PHY device driver
826 *
827 * Connect the phy specified in the device node @dn to the phylink instance
828 * specified by @pl. Actions specified in phylink_connect_phy() will be
829 * performed.
830 *
831 * Returns 0 on success or a negative errno.
832 */
833 int phylink_fwnode_phy_connect(struct phylink *pl,
834 struct fwnode_handle *fwnode,
835 u32 flags)
> 836 {
837 struct fwnode_handle *phy_node;
838 struct phy_device *phy_dev;
839 int ret;
840 int status;
841 struct fwnode_reference_args args;
842
843 /* Fixed links and 802.3z are handled without needing a PHY */
844 if (pl->link_an_mode == MLO_AN_FIXED ||
845 (pl->link_an_mode == MLO_AN_INBAND &&
846 phy_interface_mode_is_8023z(pl->link_interface)))
847 return 0;
848
849 status = acpi_node_get_property_reference(fwnode, "phy-handle", 0,
850 &args);
851 if (ACPI_FAILURE(status) || !is_acpi_device_node(args.fwnode))
852 status = acpi_node_get_property_reference(fwnode, "phy", 0,
853 &args);
854 if (ACPI_FAILURE(status) || !is_acpi_device_node(args.fwnode))
855 status = acpi_node_get_property_reference(fwnode,
856 "phy-device", 0,
857 &args);
858
859 if (ACPI_FAILURE(status) || !is_acpi_device_node(args.fwnode)) {
860 if (pl->link_an_mode == MLO_AN_PHY)
861 return -ENODEV;
862 return 0;
863 }
864
865 phy_dev = fwnode_phy_find_device(args.fwnode);
866 if (phy_dev)
867 phy_attach_direct(pl->netdev, phy_dev, flags,
868 pl->link_interface);
869
870 /* refcount is held by phy_attach_direct() on success */
871 put_device(&phy_dev->mdio.dev);
872
873 if (!phy_dev)
874 return -ENODEV;
875
876 ret = phylink_bringup_phy(pl, phy_dev);
877 if (ret)
878 phy_detach(phy_dev);
879
880 return ret;
881 }
882 EXPORT_SYMBOL_GPL(phylink_fwnode_phy_connect);
883
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/[email protected] Intel Corporation
On Fri, Jan 31, 2020 at 09:04:39PM +0530, Calvin Johnson wrote:
> From: Calvin Johnson <[email protected]>
>
> Introduce phylink_fwnode_phy_connect API to connect the PHY using
> fwnode.
>
> Signed-off-by: Calvin Johnson <[email protected]>
> ---
>
> drivers/net/phy/phylink.c | 64 +++++++++++++++++++++++++++++++++++++++
> include/linux/phylink.h | 2 ++
> 2 files changed, 66 insertions(+)
>
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index ee7a718662c6..f211f62283b5 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -18,6 +18,7 @@
> #include <linux/spinlock.h>
> #include <linux/timer.h>
> #include <linux/workqueue.h>
> +#include <linux/acpi.h>
>
> #include "sfp.h"
> #include "swphy.h"
> @@ -817,6 +818,69 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
> }
> EXPORT_SYMBOL_GPL(phylink_connect_phy);
>
> +/**
> + * phylink_fwnode_phy_connect() - connect the PHY specified in the fwnode.
> + * @pl: a pointer to a &struct phylink returned from phylink_create()
> + * @dn: a pointer to a &struct device_node.
> + * @flags: PHY-specific flags to communicate to the PHY device driver
> + *
> + * Connect the phy specified in the device node @dn to the phylink instance
> + * specified by @pl. Actions specified in phylink_connect_phy() will be
> + * performed.
> + *
> + * Returns 0 on success or a negative errno.
> + */
> +int phylink_fwnode_phy_connect(struct phylink *pl,
> + struct fwnode_handle *fwnode,
> + u32 flags)
> +{
> + struct fwnode_handle *phy_node;
> + struct phy_device *phy_dev;
> + int ret;
> + int status;
> + struct fwnode_reference_args args;
> +
> + /* Fixed links and 802.3z are handled without needing a PHY */
> + if (pl->link_an_mode == MLO_AN_FIXED ||
> + (pl->link_an_mode == MLO_AN_INBAND &&
> + phy_interface_mode_is_8023z(pl->link_interface)))
> + return 0;
> +
> + status = acpi_node_get_property_reference(fwnode, "phy-handle", 0,
> + &args);
> + if (ACPI_FAILURE(status) || !is_acpi_device_node(args.fwnode))
> + status = acpi_node_get_property_reference(fwnode, "phy", 0,
> + &args);
> + if (ACPI_FAILURE(status) || !is_acpi_device_node(args.fwnode))
> + status = acpi_node_get_property_reference(fwnode,
> + "phy-device", 0,
> + &args);
This is a copy-and-paste of phylink_of_phy_connect() without much
thought.
There is no need to duplicate the legacy DT functionality of
phy/phy-device/phy-handle in ACPI - there is no legacy to support,
so it's pointless trying to find one of three properties here.
I'd prefer both the DT and ACPI variants to be more integrated, so
we don't have two almost identical functions except for the firmware
specific detail.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
On Mon, Feb 03, 2020 at 06:41:21PM +0000, Russell King - ARM Linux admin wrote:
> On Fri, Jan 31, 2020 at 09:04:39PM +0530, Calvin Johnson wrote:
> > From: Calvin Johnson <[email protected]>
> >
> > Introduce phylink_fwnode_phy_connect API to connect the PHY using
> > fwnode.
> >
> > Signed-off-by: Calvin Johnson <[email protected]>
> > ---
> >
> > drivers/net/phy/phylink.c | 64 +++++++++++++++++++++++++++++++++++++++
> > include/linux/phylink.h | 2 ++
> > 2 files changed, 66 insertions(+)
> >
> > diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> > index ee7a718662c6..f211f62283b5 100644
> > --- a/drivers/net/phy/phylink.c
> > +++ b/drivers/net/phy/phylink.c
> > @@ -18,6 +18,7 @@
> > #include <linux/spinlock.h>
> > #include <linux/timer.h>
> > #include <linux/workqueue.h>
> > +#include <linux/acpi.h>
> >
> > #include "sfp.h"
> > #include "swphy.h"
> > @@ -817,6 +818,69 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
> > }
> > EXPORT_SYMBOL_GPL(phylink_connect_phy);
> >
> > +/**
> > + * phylink_fwnode_phy_connect() - connect the PHY specified in the fwnode.
> > + * @pl: a pointer to a &struct phylink returned from phylink_create()
> > + * @dn: a pointer to a &struct device_node.
> > + * @flags: PHY-specific flags to communicate to the PHY device driver
> > + *
> > + * Connect the phy specified in the device node @dn to the phylink instance
> > + * specified by @pl. Actions specified in phylink_connect_phy() will be
> > + * performed.
> > + *
> > + * Returns 0 on success or a negative errno.
> > + */
> > +int phylink_fwnode_phy_connect(struct phylink *pl,
> > + struct fwnode_handle *fwnode,
> > + u32 flags)
> > +{
> > + struct fwnode_handle *phy_node;
> > + struct phy_device *phy_dev;
> > + int ret;
> > + int status;
> > + struct fwnode_reference_args args;
> > +
> > + /* Fixed links and 802.3z are handled without needing a PHY */
> > + if (pl->link_an_mode == MLO_AN_FIXED ||
> > + (pl->link_an_mode == MLO_AN_INBAND &&
> > + phy_interface_mode_is_8023z(pl->link_interface)))
> > + return 0;
> > +
> > + status = acpi_node_get_property_reference(fwnode, "phy-handle", 0,
> > + &args);
> > + if (ACPI_FAILURE(status) || !is_acpi_device_node(args.fwnode))
> > + status = acpi_node_get_property_reference(fwnode, "phy", 0,
> > + &args);
> > + if (ACPI_FAILURE(status) || !is_acpi_device_node(args.fwnode))
> > + status = acpi_node_get_property_reference(fwnode,
> > + "phy-device", 0,
> > + &args);
>
> This is a copy-and-paste of phylink_of_phy_connect() without much
> thought.
>
> There is no need to duplicate the legacy DT functionality of
> phy/phy-device/phy-handle in ACPI - there is no legacy to support,
> so it's pointless trying to find one of three properties here.
>
> I'd prefer both the DT and ACPI variants to be more integrated, so
> we don't have two almost identical functions except for the firmware
> specific detail.
Also, I don't see any ACPI folk in the list of recipients to your
series.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
> -----Original Message-----
> From: Andy Shevchenko <[email protected]>
> Subject: Re: [PATCH v1 3/7] net/fsl: add ACPI support for mdio bus
>
> On Fri, Jan 31, 2020 at 5:37 PM Calvin Johnson <[email protected]>
> wrote:
> >
> > From: Calvin Johnson <[email protected]>
> >
> > Add ACPI support for MDIO bus registration while maintaining the
> > existing DT support.
>
> ...
>
> > - ret = of_address_to_resource(np, 0, &res);
> > - if (ret) {
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + if (!res) {
> > dev_err(&pdev->dev, "could not obtain address\n");
> > - return ret;
> > + return -ENODEV;
> > }
>
> ...
>
> > - snprintf(bus->id, MII_BUS_ID_SIZE, "%llx", (unsigned long
> long)res.start);
> > + snprintf(bus->id, MII_BUS_ID_SIZE, "%llx",
> > + (unsigned long long)res->start);
>
> Why this has been touched?
Without this change, I get:
---------------------------------------------------------
drivers/net/ethernet/freescale/xgmac_mdio.c: In function 'xgmac_mdio_probe':
drivers/net/ethernet/freescale/xgmac_mdio.c:269:27: error: request for member 'start' in something not a structure or union
(unsigned long long)res.start);
^
scripts/Makefile.build:265: recipe for target 'drivers/net/ethernet/freescale/xgmac_mdio.o' failed
make[4]: *** [drivers/net/ethernet/freescale/xgmac_mdio.o] Error 1
---------------------------------------------------------
On checking other files that calls platform_get_resource, I can see that this is the way they refer 'start'.
>
> ...
>
> > - priv->mdio_base = of_iomap(np, 0);
> > + priv->mdio_base = devm_ioremap_resource(&pdev->dev, res);
> > if (!priv->mdio_base) {
>
> Are you sure the check is correct now?
devm_ioremap_resource returns non-NULL error values. So, this doesn't look right.
I'll work on it for v2.
> > ret = -ENOMEM;
> > goto err_ioremap;
> > }
>
> ...
>
> >
> > - priv->is_little_endian = of_property_read_bool(pdev->dev.of_node,
> > - "little-endian");
> > -
> > - priv->has_a011043 = of_property_read_bool(pdev->dev.of_node,
> > - "fsl,erratum-a011043");
> > -
> > - ret = of_mdiobus_register(bus, np);
> > - if (ret) {
> > - dev_err(&pdev->dev, "cannot register MDIO bus\n");
>
> > + if (is_of_node(pdev->dev.fwnode)) {
>
> > + } else if (is_acpi_node(pdev->dev.fwnode)) {
>
> Oh, no, this is wrong. Pure approach AFAICS is to use fwnode API or device
> property API.
>
> And actually what you need to include is rather <linux/property.h>, and not
> acpi.h.
Understood. I had got some issues while using fwnode API to handle DT case due to which
DT/ACPI checks were done and both are handled separately. Let me see if I can root cause it.
>
> > + } else {
> > + dev_err(&pdev->dev, "Cannot get cfg data from DT or ACPI\n");
> > + ret = -ENXIO;
> > goto err_registration;
> > }
>
> > +static const struct acpi_device_id xgmac_mdio_acpi_match[] = {
> > + {"NXP0006", 0}
>
> How did you test this on platforms with the same IP and without device of
> this ACPI ID present?
I didn't test it on any other platforms other than LX2160ARDB. AFAIU, without
device of this ACPI ID present, the driver won't get probed.
> (Hint: missed terminator)
static const struct acpi_device_id xgmac_mdio_acpi_match[] = {
{ "NXP0006", 0 },
{ }
};
Is this what you meant?
>
> > +};
> > +MODULE_DEVICE_TABLE(acpi, xgmac_mdio_acpi_match);
>
> > + .acpi_match_table = ACPI_PTR(xgmac_mdio_acpi_match),
>
> ACPI_PTR is not needed otherwise you will get a compiler warning.
No compiler warning was observed in both cases.
I can see other drivers using this macro.
drivers/net/ethernet/apm/xgene-v2/main.c:734: .acpi_match_table = ACPI_PTR(xge_acpi_match),
drivers/net/ethernet/apm/xgene/xgene_enet_main.c:2172: .acpi_match_table = ACPI_PTR(xgene_enet_acpi_match),
drivers/net/ethernet/hisilicon/hns/hns_enet.c:2445: .acpi_match_table = ACPI_PTR(hns_enet_acpi_match),
drivers/net/ethernet/hisilicon/hns_mdio.c:566: .acpi_match_table = ACPI_PTR(hns_mdio_acpi_match),
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c:5997: .acpi_match_table = ACPI_PTR(mvpp2_acpi_match),
drivers/net/ethernet/qualcomm/emac/emac.c:766: .acpi_match_table = ACPI_PTR(emac_acpi_match),
drivers/net/ethernet/smsc/smsc911x.c:2667: .acpi_match_table = ACPI_PTR(smsc911x_acpi_match),
drivers/net/ethernet/socionext/netsec.c:2187: .acpi_match_table = ACPI_PTR(netsec_acpi_ids),
drivers/net/phy/mdio-xgene.c:456: .acpi_match_table = ACPI_PTR(xgene_mdio_acpi_match),
Thanks
Calvin
On Tue, Feb 4, 2020 at 9:18 AM Calvin Johnson (OSS)
<[email protected]> wrote:
> > -----Original Message-----
> > From: Andy Shevchenko <[email protected]>
> > Subject: Re: [PATCH v1 3/7] net/fsl: add ACPI support for mdio bus
> > On Fri, Jan 31, 2020 at 5:37 PM Calvin Johnson <[email protected]>
> > wrote:
...
> > > - snprintf(bus->id, MII_BUS_ID_SIZE, "%llx", (unsigned long
> > long)res.start);
> > > + snprintf(bus->id, MII_BUS_ID_SIZE, "%llx",
> > > + (unsigned long long)res->start);
> >
> > Why this has been touched?
>
> Without this change, I get:
> ---------------------------------------------------------
> drivers/net/ethernet/freescale/xgmac_mdio.c: In function 'xgmac_mdio_probe':
> drivers/net/ethernet/freescale/xgmac_mdio.c:269:27: error: request for member 'start' in something not a structure or union
> (unsigned long long)res.start);
> ^
> scripts/Makefile.build:265: recipe for target 'drivers/net/ethernet/freescale/xgmac_mdio.o' failed
> make[4]: *** [drivers/net/ethernet/freescale/xgmac_mdio.o] Error 1
> ---------------------------------------------------------
I see. Thanks.
Can you leave it one line as it was before?
...
> > (Hint: missed terminator)
> static const struct acpi_device_id xgmac_mdio_acpi_match[] = {
> { "NXP0006", 0 },
> { }
> };
> Is this what you meant?
Yes!
...
> > > + .acpi_match_table = ACPI_PTR(xgmac_mdio_acpi_match),
> >
> > ACPI_PTR is not needed otherwise you will get a compiler warning.
>
> No compiler warning was observed in both cases.
You mean you tried CONFIG_ACPI=n and didn't get a warning about unused
static variable?
Perhaps you may run `make W=1 ...`
> I can see other drivers using this macro.
They might have hidden same issue.
--
With Best Regards,
Andy Shevchenko
On Sun, Feb 02, 2020 at 07:44:40PM -0800, Florian Fainelli wrote:
>
>
> On 1/31/2020 7:34 AM, Calvin Johnson wrote:
> > From: Calvin Johnson <[email protected]>
> >
> > Add ACPI support for MDIO bus registration while maintaining
> > the existing DT support.
> >
> > Signed-off-by: Calvin Johnson <[email protected]>
> > ---
>
> [snip]
>
> > bus = mdiobus_alloc_size(sizeof(struct mdio_fsl_priv));
> > @@ -263,25 +265,41 @@ static int xgmac_mdio_probe(struct platform_device *pdev)
> > bus->read = xgmac_mdio_read;
> > bus->write = xgmac_mdio_write;
> > bus->parent = &pdev->dev;
> > - snprintf(bus->id, MII_BUS_ID_SIZE, "%llx", (unsigned long long)res.start);
> > + snprintf(bus->id, MII_BUS_ID_SIZE, "%llx",
> > + (unsigned long long)res->start);
>
> You could omit this clean up change.
Sure, will avoid split to newline.
> >
> > /* Set the PHY base address */
> > priv = bus->priv;
> > - priv->mdio_base = of_iomap(np, 0);
> > + priv->mdio_base = devm_ioremap_resource(&pdev->dev, res);
> > if (!priv->mdio_base) {
>
> This probably needs to become IS_ERR() instead of a plain NULL check
Ok. Will take care in v2.
>
> > ret = -ENOMEM;
> > goto err_ioremap;
> > }
> >
> > - priv->is_little_endian = of_property_read_bool(pdev->dev.of_node,
> > - "little-endian");
> > -
> > - priv->has_a011043 = of_property_read_bool(pdev->dev.of_node,
> > - "fsl,erratum-a011043");
> > -
> > - ret = of_mdiobus_register(bus, np);
> > - if (ret) {
> > - dev_err(&pdev->dev, "cannot register MDIO bus\n");
> > + if (is_of_node(pdev->dev.fwnode)) {
> > + priv->is_little_endian = of_property_read_bool(pdev->dev.of_node,
> > + "little-endian");
> > +
> > + priv->has_a011043 = of_property_read_bool(pdev->dev.of_node,
> > + "fsl,erratum-a011043");
> > +
> > + ret = of_mdiobus_register(bus, np);
> > + if (ret) {
> > + dev_err(&pdev->dev, "cannot register MDIO bus\n");
> > + goto err_registration;
> > + }
> > + } else if (is_acpi_node(pdev->dev.fwnode)) {
> > + priv->is_little_endian =
> > + fwnode_property_read_bool(pdev->dev.fwnode,
> > + "little-endian");
> > + ret = fwnode_mdiobus_register(bus, pdev->dev.fwnode);
> > + if (ret) {
> > + dev_err(&pdev->dev, "cannot register MDIO bus\n");
> > + goto err_registration;
> > + }
>
> The little-endian property read can be moved out of the DT/ACPI paths
> and you can just use device_property_read_bool() for that purpose.
> Having both fwnode_mdiobus_register() and of_mdiobus_register() looks
> fairly redundant, you could quite easily introduce a wrapper:
> device_mdiobus_register() which internally takes the appropriate DT/ACPI
> paths as needed.
Had some difficulty with DT while using fwnode APIs. Will resolve them
and provide better integrated code.
Thanks
Calvin
Hi Florian
> -----Original Message-----
> From: Florian Fainelli <[email protected]>
> Sent: Monday, February 3, 2020 11:32 PM
> To: Calvin Johnson <[email protected]>; [email protected]; Jon
<snip>
> On 1/31/20 7:34 AM, Calvin Johnson wrote:
> > From: Calvin Johnson <[email protected]>
> >
> > This patch series provides ACPI support for xgmac_mdio and dpaa2-mac
> > driver. Most of the DT APIs are replaced with fwnode APIs to handle
> > both DT and ACPI nodes.
> >
> > Old patch by Marcin Wojtas: (mdio_bus: Introduce fwnode MDIO helpers),
> > is reused in this series to get some fwnode mdio helper APIs.
>
> Andrew's comment on your first patch is a good summary of what this patch
> series does, instead of consolidating the existing code and making it less of_*
> centric and more firmware agnostic, this duplicates the existing infrastructure
> almost line for line to create a fwnode specific implementation. The
> preference would be for you to move away from that and use device_*
> properties as much as possible while making the code capable of handling all
> firmware implementations.
Thanks for the suggestion. Will take this direction for v2.
> Can you also show a few DSDT for the devices that you are working so we can
> a feeling of how you represented the various properties and parent/child
> devices dependencies?
https://source.codeaurora.org/external/qoriq/qoriq-components/edk2-platforms/tree/Platform/NXP/LX2160aRdbPkg/AcpiTables/Dsdt/Mdio.asl?h=LX2160_UEFI_ACPI_EAR1
https://source.codeaurora.org/external/qoriq/qoriq-components/edk2-platforms/tree/Platform/NXP/LX2160aRdbPkg/AcpiTables/Dsdt/Mc.asl?h=LX2160_UEFI_ACPI_EAR1
Thanks
Calvin
> -----Original Message-----
> From: Russell King - ARM Linux admin <[email protected]>
> Sent: Tuesday, February 4, 2020 12:11 AM
> To: Calvin Johnson <[email protected]>
<snip>
> > Introduce phylink_fwnode_phy_connect API to connect the PHY using
> > fwnode.
> >
> > Signed-off-by: Calvin Johnson <[email protected]>
> > ---
> >
> > drivers/net/phy/phylink.c | 64
> +++++++++++++++++++++++++++++++++++++++
> > include/linux/phylink.h | 2 ++
> > 2 files changed, 66 insertions(+)
> >
> > diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> > index ee7a718662c6..f211f62283b5 100644
> > --- a/drivers/net/phy/phylink.c
> > +++ b/drivers/net/phy/phylink.c
> > @@ -18,6 +18,7 @@
> > #include <linux/spinlock.h>
> > #include <linux/timer.h>
> > #include <linux/workqueue.h>
> > +#include <linux/acpi.h>
> >
> > #include "sfp.h"
> > #include "swphy.h"
> > @@ -817,6 +818,69 @@ int phylink_connect_phy(struct phylink *pl,
> > struct phy_device *phy) } EXPORT_SYMBOL_GPL(phylink_connect_phy);
> >
> > +/**
> > + * phylink_fwnode_phy_connect() - connect the PHY specified in the
> fwnode.
> > + * @pl: a pointer to a &struct phylink returned from phylink_create()
> > + * @dn: a pointer to a &struct device_node.
> > + * @flags: PHY-specific flags to communicate to the PHY device driver
> > + *
> > + * Connect the phy specified in the device node @dn to the phylink
> > +instance
> > + * specified by @pl. Actions specified in phylink_connect_phy() will
> > +be
> > + * performed.
> > + *
> > + * Returns 0 on success or a negative errno.
> > + */
> > +int phylink_fwnode_phy_connect(struct phylink *pl,
> > + struct fwnode_handle *fwnode,
> > + u32 flags) {
> > + struct fwnode_handle *phy_node;
> > + struct phy_device *phy_dev;
> > + int ret;
> > + int status;
> > + struct fwnode_reference_args args;
> > +
> > + /* Fixed links and 802.3z are handled without needing a PHY */
> > + if (pl->link_an_mode == MLO_AN_FIXED ||
> > + (pl->link_an_mode == MLO_AN_INBAND &&
> > + phy_interface_mode_is_8023z(pl->link_interface)))
> > + return 0;
> > +
> > + status = acpi_node_get_property_reference(fwnode, "phy-handle", 0,
> > + &args);
> > + if (ACPI_FAILURE(status) || !is_acpi_device_node(args.fwnode))
> > + status = acpi_node_get_property_reference(fwnode, "phy", 0,
> > + &args);
> > + if (ACPI_FAILURE(status) || !is_acpi_device_node(args.fwnode))
> > + status = acpi_node_get_property_reference(fwnode,
> > + "phy-device", 0,
> > + &args);
>
> This is a copy-and-paste of phylink_of_phy_connect() without much thought.
>
> There is no need to duplicate the legacy DT functionality of phy/phy-
> device/phy-handle in ACPI - there is no legacy to support, so it's pointless
> trying to find one of three properties here.
Ok. I'll remove it.
> I'd prefer both the DT and ACPI variants to be more integrated, so we don't
> have two almost identical functions except for the firmware specific detail.
Did you mean phylink_of_phy_connect replaced with phylink_fwnode_phy_connect?
I can add DT handling also inside phylink_fwnode_phy_connect. Please let me know.
Thanks for pointing out about adding linux-acpi ML. I started added them in my responses.
I was assuming they would be added by get_maintainer.pl.
Thanks
Calvin