2019-10-31 01:18:31 +02:00
|
|
|
/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
|
|
|
|
/* Copyright 2019 NXP */
|
|
|
|
#ifndef DPAA2_MAC_H
|
|
|
|
#define DPAA2_MAC_H
|
|
|
|
|
|
|
|
#include <linux/of.h>
|
|
|
|
#include <linux/of_mdio.h>
|
|
|
|
#include <linux/of_net.h>
|
|
|
|
#include <linux/phylink.h>
|
|
|
|
|
|
|
|
#include "dpmac.h"
|
|
|
|
#include "dpmac-cmd.h"
|
|
|
|
|
|
|
|
struct dpaa2_mac {
|
|
|
|
struct fsl_mc_device *mc_dev;
|
|
|
|
struct dpmac_link_state state;
|
|
|
|
struct net_device *net_dev;
|
|
|
|
struct fsl_mc_io *mc_io;
|
2021-01-08 11:07:22 +02:00
|
|
|
struct dpmac_attr attr;
|
2022-03-11 23:22:25 +02:00
|
|
|
u16 ver_major, ver_minor;
|
|
|
|
unsigned long features;
|
2019-10-31 01:18:31 +02:00
|
|
|
|
|
|
|
struct phylink_config phylink_config;
|
|
|
|
struct phylink *phylink;
|
|
|
|
phy_interface_t if_mode;
|
2020-02-26 10:24:01 +00:00
|
|
|
enum dpmac_link_type if_link_type;
|
2021-12-28 21:03:06 -08:00
|
|
|
struct phylink_pcs *pcs;
|
2021-06-11 13:54:01 +03:00
|
|
|
struct fwnode_handle *fw_node;
|
2022-03-11 23:22:27 +02:00
|
|
|
|
|
|
|
struct phy *serdes_phy;
|
2019-10-31 01:18:31 +02:00
|
|
|
};
|
|
|
|
|
2022-11-29 16:12:11 +02:00
|
|
|
static inline bool dpaa2_mac_is_type_phy(struct dpaa2_mac *mac)
|
|
|
|
{
|
|
|
|
if (!mac)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return mac->attr.link_type == DPMAC_LINK_TYPE_PHY ||
|
|
|
|
mac->attr.link_type == DPMAC_LINK_TYPE_BACKPLANE;
|
|
|
|
}
|
2019-10-31 01:18:31 +02:00
|
|
|
|
2021-01-08 11:07:22 +02:00
|
|
|
int dpaa2_mac_open(struct dpaa2_mac *mac);
|
|
|
|
|
|
|
|
void dpaa2_mac_close(struct dpaa2_mac *mac);
|
|
|
|
|
2019-10-31 01:18:31 +02:00
|
|
|
int dpaa2_mac_connect(struct dpaa2_mac *mac);
|
|
|
|
|
|
|
|
void dpaa2_mac_disconnect(struct dpaa2_mac *mac);
|
|
|
|
|
2019-11-07 12:44:48 +02:00
|
|
|
int dpaa2_mac_get_sset_count(void);
|
|
|
|
|
|
|
|
void dpaa2_mac_get_strings(u8 *data);
|
|
|
|
|
|
|
|
void dpaa2_mac_get_ethtool_stats(struct dpaa2_mac *mac, u64 *data);
|
|
|
|
|
2022-03-11 23:22:27 +02:00
|
|
|
void dpaa2_mac_start(struct dpaa2_mac *mac);
|
|
|
|
|
|
|
|
void dpaa2_mac_stop(struct dpaa2_mac *mac);
|
|
|
|
|
2019-10-31 01:18:31 +02:00
|
|
|
#endif /* DPAA2_MAC_H */
|