/* 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 * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * */#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt#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/etherdevice.h>#include<linux/skbuff.h>#include<linux/mm.h>#include<linux/module.h>#include<linux/mii.h>#include<linux/ethtool.h>#include<linux/phy.h>#include<linux/timer.h>#include<linux/workqueue.h>#include<linux/mdio.h>#include<linux/io.h>#include<linux/uaccess.h>#include<linux/atomic.h>#include<asm/irq.h>staticconstchar*phy_speed_to_str(intspeed){switch(speed){caseSPEED_10:return"10Mbps";caseSPEED_100:return"100Mbps";caseSPEED_1000:return"1Gbps";caseSPEED_2500:return"2.5Gbps";caseSPEED_10000:return"10Gbps";caseSPEED_UNKNOWN:return"Unknown";default:return"Unsupported (update phy.c)";}}#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(STARTING)PHY_STATE_STR(READY)PHY_STATE_STR(PENDING)PHY_STATE_STR(UP)PHY_STATE_STR(AN)PHY_STATE_STR(RUNNING)PHY_STATE_STR(NOLINK)PHY_STATE_STR(FORCING)PHY_STATE_STR(CHANGELINK)PHY_STATE_STR(HALTED)PHY_STATE_STR(RESUMING)}returnNULL;}/**