net: phylink: make phylink_parse_mode() support non-DT platform
authorOng Boon Leong <boon.leong.ong@intel.com>
Mon, 15 Mar 2021 05:27:08 +0000 (13:27 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 Mar 2021 19:53:12 +0000 (12:53 -0700)
Certain platform does not support DT, so we make phylink_parse_mode() to
allow non-DT platform to use it to setup in-band AN advertising.

Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phylink.c
include/linux/phylink.h

index 053c92e02cd81a60008ecedb64bc85d3c1de3b57..12a047d47dec0aecdf7ce2bb7a596ff885b55caf 100644 (file)
@@ -271,8 +271,9 @@ static int phylink_parse_mode(struct phylink *pl, struct fwnode_handle *fwnode)
                pl->cfg_link_an_mode = MLO_AN_FIXED;
        fwnode_handle_put(dn);
 
-       if (fwnode_property_read_string(fwnode, "managed", &managed) == 0 &&
-           strcmp(managed, "in-band-status") == 0) {
+       if ((fwnode_property_read_string(fwnode, "managed", &managed) == 0 &&
+            strcmp(managed, "in-band-status") == 0) ||
+           pl->config->ovr_an_inband) {
                if (pl->cfg_link_an_mode == MLO_AN_FIXED) {
                        phylink_err(pl,
                                    "can't use both fixed-link and in-band-status\n");
index d81a714cfbbdb16dd73711c4f10f3c1445c0f249..fd2acfd9b597d547f06a858a0bd3263ed1b78fd9 100644 (file)
@@ -64,6 +64,7 @@ enum phylink_op_type {
  * @pcs_poll: MAC PCS cannot provide link change interrupt
  * @poll_fixed_state: if true, starts link_poll,
  *                   if MAC link is at %MLO_AN_FIXED mode.
+ * @ovr_an_inband: if true, override PCS to MLO_AN_INBAND
  * @get_fixed_state: callback to execute to determine the fixed link state,
  *                  if MAC link is at %MLO_AN_FIXED mode.
  */
@@ -72,6 +73,7 @@ struct phylink_config {
        enum phylink_op_type type;
        bool pcs_poll;
        bool poll_fixed_state;
+       bool ovr_an_inband;
        void (*get_fixed_state)(struct phylink_config *config,
                                struct phylink_link_state *state);
 };