// SPDX-License-Identifier: GPL-2.0+/* Framework for configuring and reading PHY devices * Based on code in sungem_phy.c and gianfar_phy.c * * Author: Andy Fleming * * Copyright (c) 2004 Freescale Semiconductor, Inc. * Copyright (c) 2006, 2007 Maciej W. Rozycki */#include<linux/kernel.h>#include<linux/string.h>#include<linux/errno.h>#include<linux/unistd.h>#include<linux/interrupt.h>#include<linux/delay.h>#include<linux/netdevice.h>#include<linux/netlink.h>#include<linux/etherdevice.h>#include<linux/skbuff.h>#include<linux/mm.h>#include<linux/module.h>#include<linux/mii.h>#include<linux/ethtool.h>#include<linux/ethtool_netlink.h>#include<linux/phy.h>#include<linux/phy_led_triggers.h>#include<linux/sfp.h>#include<linux/workqueue.h>#include<linux/mdio.h>#include<linux/io.h>#include<linux/uaccess.h>#include<linux/atomic.h>#include<net/netlink.h>#include<net/genetlink.h>#include<net/sock.h>#define PHY_STATE_TIME HZ#define PHY_STATE_STR(_state) \ case PHY_##_state: \ return __stringify(_state); \staticconstchar*phy_state_to_str(enumphy_statest){switch(st){PHY_STATE_STR(DOWN)PHY_STATE_STR(READY)PHY_STATE_STR(UP)PHY_STATE_STR(RUNNING)PHY_STATE_STR(NOLINK)PHY_STATE_STR(CABLETEST)PHY_STATE_STR(HALTED)}returnNULL;}staticvoidphy_link_up(structphy_device*phydev){