2016-08-05 20:24:21 +08:00
|
|
|
/*
|
|
|
|
* Driver for Microsemi VSC85xx PHYs
|
|
|
|
*
|
|
|
|
* Author: Nagaraju Lakkaraju
|
|
|
|
* License: Dual MIT/GPL
|
|
|
|
* Copyright (c) 2016 Microsemi Corporation
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/mdio.h>
|
|
|
|
#include <linux/mii.h>
|
|
|
|
#include <linux/phy.h>
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
#include <linux/of.h>
|
2016-10-05 16:49:27 +08:00
|
|
|
#include <linux/netdevice.h>
|
2017-02-07 21:40:26 +08:00
|
|
|
#include <dt-bindings/net/mscc-phy-vsc8531.h>
|
2016-08-05 20:24:21 +08:00
|
|
|
|
|
|
|
enum rgmii_rx_clock_delay {
|
2016-09-08 16:39:31 +08:00
|
|
|
RGMII_RX_CLK_DELAY_0_2_NS = 0,
|
|
|
|
RGMII_RX_CLK_DELAY_0_8_NS = 1,
|
|
|
|
RGMII_RX_CLK_DELAY_1_1_NS = 2,
|
|
|
|
RGMII_RX_CLK_DELAY_1_7_NS = 3,
|
|
|
|
RGMII_RX_CLK_DELAY_2_0_NS = 4,
|
|
|
|
RGMII_RX_CLK_DELAY_2_3_NS = 5,
|
|
|
|
RGMII_RX_CLK_DELAY_2_6_NS = 6,
|
|
|
|
RGMII_RX_CLK_DELAY_3_4_NS = 7
|
2016-08-05 20:24:21 +08:00
|
|
|
};
|
|
|
|
|
2016-09-19 18:03:54 +08:00
|
|
|
/* Microsemi VSC85xx PHY registers */
|
|
|
|
/* IEEE 802. Std Registers */
|
2016-11-29 17:46:48 +08:00
|
|
|
#define MSCC_PHY_BYPASS_CONTROL 18
|
|
|
|
#define DISABLE_HP_AUTO_MDIX_MASK 0x0080
|
|
|
|
#define DISABLE_PAIR_SWAP_CORR_MASK 0x0020
|
|
|
|
#define DISABLE_POLARITY_CORR_MASK 0x0010
|
|
|
|
|
2018-10-08 18:07:24 +08:00
|
|
|
#define MSCC_PHY_ERR_RX_CNT 19
|
|
|
|
#define MSCC_PHY_ERR_FALSE_CARRIER_CNT 20
|
|
|
|
#define MSCC_PHY_ERR_LINK_DISCONNECT_CNT 21
|
|
|
|
#define ERR_CNT_MASK GENMASK(7, 0)
|
|
|
|
|
2016-09-19 18:03:54 +08:00
|
|
|
#define MSCC_PHY_EXT_PHY_CNTL_1 23
|
|
|
|
#define MAC_IF_SELECTION_MASK 0x1800
|
|
|
|
#define MAC_IF_SELECTION_GMII 0
|
|
|
|
#define MAC_IF_SELECTION_RMII 1
|
|
|
|
#define MAC_IF_SELECTION_RGMII 2
|
|
|
|
#define MAC_IF_SELECTION_POS 11
|
|
|
|
#define FAR_END_LOOPBACK_MODE_MASK 0x0008
|
|
|
|
|
2016-09-08 16:39:31 +08:00
|
|
|
#define MII_VSC85XX_INT_MASK 25
|
|
|
|
#define MII_VSC85XX_INT_MASK_MASK 0xa000
|
2016-10-05 16:49:27 +08:00
|
|
|
#define MII_VSC85XX_INT_MASK_WOL 0x0040
|
2016-09-08 16:39:31 +08:00
|
|
|
#define MII_VSC85XX_INT_STATUS 26
|
2016-08-05 20:24:21 +08:00
|
|
|
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
#define MSCC_PHY_WOL_MAC_CONTROL 27
|
|
|
|
#define EDGE_RATE_CNTL_POS 5
|
|
|
|
#define EDGE_RATE_CNTL_MASK 0x00E0
|
|
|
|
|
2016-11-29 17:46:48 +08:00
|
|
|
#define MSCC_PHY_DEV_AUX_CNTL 28
|
|
|
|
#define HP_AUTO_MDIX_X_OVER_IND_MASK 0x2000
|
|
|
|
|
2017-02-07 21:40:26 +08:00
|
|
|
#define MSCC_PHY_LED_MODE_SEL 29
|
2018-09-03 16:48:47 +08:00
|
|
|
#define LED_MODE_SEL_POS(x) ((x) * 4)
|
|
|
|
#define LED_MODE_SEL_MASK(x) (GENMASK(3, 0) << LED_MODE_SEL_POS(x))
|
|
|
|
#define LED_MODE_SEL(x, mode) (((mode) << LED_MODE_SEL_POS(x)) & LED_MODE_SEL_MASK(x))
|
2017-02-07 21:40:26 +08:00
|
|
|
|
2016-09-08 16:39:31 +08:00
|
|
|
#define MSCC_EXT_PAGE_ACCESS 31
|
|
|
|
#define MSCC_PHY_PAGE_STANDARD 0x0000 /* Standard registers */
|
2016-11-17 20:07:24 +08:00
|
|
|
#define MSCC_PHY_PAGE_EXTENDED 0x0001 /* Extended registers */
|
2016-09-08 16:39:31 +08:00
|
|
|
#define MSCC_PHY_PAGE_EXTENDED_2 0x0002 /* Extended reg - page 2 */
|
2018-10-08 18:07:25 +08:00
|
|
|
#define MSCC_PHY_PAGE_TR 0x52b5 /* Token ring registers */
|
2016-08-05 20:24:21 +08:00
|
|
|
|
2016-11-17 20:07:24 +08:00
|
|
|
/* Extended Page 1 Registers */
|
2018-10-08 18:07:24 +08:00
|
|
|
#define MSCC_PHY_CU_MEDIA_CRC_VALID_CNT 18
|
|
|
|
#define VALID_CRC_CNT_CRC_MASK GENMASK(13, 0)
|
|
|
|
|
2016-11-29 17:46:48 +08:00
|
|
|
#define MSCC_PHY_EXT_MODE_CNTL 19
|
|
|
|
#define FORCE_MDI_CROSSOVER_MASK 0x000C
|
|
|
|
#define FORCE_MDI_CROSSOVER_MDIX 0x000C
|
|
|
|
#define FORCE_MDI_CROSSOVER_MDI 0x0008
|
|
|
|
|
2016-11-17 20:07:24 +08:00
|
|
|
#define MSCC_PHY_ACTIPHY_CNTL 20
|
|
|
|
#define DOWNSHIFT_CNTL_MASK 0x001C
|
|
|
|
#define DOWNSHIFT_EN 0x0010
|
|
|
|
#define DOWNSHIFT_CNTL_POS 2
|
|
|
|
|
2018-10-08 18:07:24 +08:00
|
|
|
#define MSCC_PHY_EXT_PHY_CNTL_4 23
|
|
|
|
|
2016-08-05 20:24:21 +08:00
|
|
|
/* Extended Page 2 Registers */
|
2016-09-08 16:39:31 +08:00
|
|
|
#define MSCC_PHY_RGMII_CNTL 20
|
|
|
|
#define RGMII_RX_CLK_DELAY_MASK 0x0070
|
|
|
|
#define RGMII_RX_CLK_DELAY_POS 4
|
2016-08-05 20:24:21 +08:00
|
|
|
|
2016-10-05 16:49:27 +08:00
|
|
|
#define MSCC_PHY_WOL_LOWER_MAC_ADDR 21
|
|
|
|
#define MSCC_PHY_WOL_MID_MAC_ADDR 22
|
|
|
|
#define MSCC_PHY_WOL_UPPER_MAC_ADDR 23
|
|
|
|
#define MSCC_PHY_WOL_LOWER_PASSWD 24
|
|
|
|
#define MSCC_PHY_WOL_MID_PASSWD 25
|
|
|
|
#define MSCC_PHY_WOL_UPPER_PASSWD 26
|
|
|
|
|
|
|
|
#define MSCC_PHY_WOL_MAC_CONTROL 27
|
|
|
|
#define SECURE_ON_ENABLE 0x8000
|
|
|
|
#define SECURE_ON_PASSWD_LEN_4 0x4000
|
|
|
|
|
2018-10-08 18:07:25 +08:00
|
|
|
/* Token ring page Registers */
|
|
|
|
#define MSCC_PHY_TR_CNTL 16
|
|
|
|
#define TR_WRITE 0x8000
|
|
|
|
#define TR_ADDR(x) (0x7fff & (x))
|
|
|
|
#define MSCC_PHY_TR_LSB 17
|
|
|
|
#define MSCC_PHY_TR_MSB 18
|
|
|
|
|
2016-08-05 20:24:21 +08:00
|
|
|
/* Microsemi PHY ID's */
|
2016-10-28 18:10:11 +08:00
|
|
|
#define PHY_ID_VSC8530 0x00070560
|
2016-09-08 16:39:31 +08:00
|
|
|
#define PHY_ID_VSC8531 0x00070570
|
2016-10-28 18:10:11 +08:00
|
|
|
#define PHY_ID_VSC8540 0x00070760
|
2016-09-08 16:39:31 +08:00
|
|
|
#define PHY_ID_VSC8541 0x00070770
|
2016-08-05 20:24:21 +08:00
|
|
|
|
2016-10-12 21:47:51 +08:00
|
|
|
#define MSCC_VDDMAC_1500 1500
|
|
|
|
#define MSCC_VDDMAC_1800 1800
|
|
|
|
#define MSCC_VDDMAC_2500 2500
|
|
|
|
#define MSCC_VDDMAC_3300 3300
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
|
2016-11-17 20:07:24 +08:00
|
|
|
#define DOWNSHIFT_COUNT_MAX 5
|
|
|
|
|
2018-09-03 16:48:47 +08:00
|
|
|
#define MAX_LEDS 4
|
2018-09-03 16:48:48 +08:00
|
|
|
#define VSC85XX_SUPP_LED_MODES (BIT(VSC8531_LINK_ACTIVITY) | \
|
|
|
|
BIT(VSC8531_LINK_1000_ACTIVITY) | \
|
|
|
|
BIT(VSC8531_LINK_100_ACTIVITY) | \
|
|
|
|
BIT(VSC8531_LINK_10_ACTIVITY) | \
|
|
|
|
BIT(VSC8531_LINK_100_1000_ACTIVITY) | \
|
|
|
|
BIT(VSC8531_LINK_10_1000_ACTIVITY) | \
|
|
|
|
BIT(VSC8531_LINK_10_100_ACTIVITY) | \
|
|
|
|
BIT(VSC8531_DUPLEX_COLLISION) | \
|
|
|
|
BIT(VSC8531_COLLISION) | \
|
|
|
|
BIT(VSC8531_ACTIVITY) | \
|
|
|
|
BIT(VSC8531_AUTONEG_FAULT) | \
|
|
|
|
BIT(VSC8531_SERIAL_MODE) | \
|
|
|
|
BIT(VSC8531_FORCE_LED_OFF) | \
|
|
|
|
BIT(VSC8531_FORCE_LED_ON))
|
|
|
|
|
2018-10-08 18:07:25 +08:00
|
|
|
struct reg_val {
|
|
|
|
u16 reg;
|
|
|
|
u32 val;
|
|
|
|
};
|
|
|
|
|
2018-10-08 18:07:24 +08:00
|
|
|
struct vsc85xx_hw_stat {
|
|
|
|
const char *string;
|
|
|
|
u8 reg;
|
|
|
|
u16 page;
|
|
|
|
u16 mask;
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct vsc85xx_hw_stat vsc85xx_hw_stats[] = {
|
|
|
|
{
|
|
|
|
.string = "phy_receive_errors",
|
|
|
|
.reg = MSCC_PHY_ERR_RX_CNT,
|
|
|
|
.page = MSCC_PHY_PAGE_STANDARD,
|
|
|
|
.mask = ERR_CNT_MASK,
|
|
|
|
}, {
|
|
|
|
.string = "phy_false_carrier",
|
|
|
|
.reg = MSCC_PHY_ERR_FALSE_CARRIER_CNT,
|
|
|
|
.page = MSCC_PHY_PAGE_STANDARD,
|
|
|
|
.mask = ERR_CNT_MASK,
|
|
|
|
}, {
|
|
|
|
.string = "phy_cu_media_link_disconnect",
|
|
|
|
.reg = MSCC_PHY_ERR_LINK_DISCONNECT_CNT,
|
|
|
|
.page = MSCC_PHY_PAGE_STANDARD,
|
|
|
|
.mask = ERR_CNT_MASK,
|
|
|
|
}, {
|
|
|
|
.string = "phy_cu_media_crc_good_count",
|
|
|
|
.reg = MSCC_PHY_CU_MEDIA_CRC_VALID_CNT,
|
|
|
|
.page = MSCC_PHY_PAGE_EXTENDED,
|
|
|
|
.mask = VALID_CRC_CNT_CRC_MASK,
|
|
|
|
}, {
|
|
|
|
.string = "phy_cu_media_crc_error_count",
|
|
|
|
.reg = MSCC_PHY_EXT_PHY_CNTL_4,
|
|
|
|
.page = MSCC_PHY_PAGE_EXTENDED,
|
|
|
|
.mask = ERR_CNT_MASK,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2016-10-12 21:47:51 +08:00
|
|
|
struct vsc8531_private {
|
|
|
|
int rate_magic;
|
2018-09-03 16:48:48 +08:00
|
|
|
u16 supp_led_modes;
|
2018-09-03 16:48:51 +08:00
|
|
|
u32 leds_mode[MAX_LEDS];
|
2018-09-03 16:48:47 +08:00
|
|
|
u8 nleds;
|
2018-10-08 18:07:24 +08:00
|
|
|
const struct vsc85xx_hw_stat *hw_stats;
|
|
|
|
u64 *stats;
|
|
|
|
int nstats;
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
};
|
|
|
|
|
2016-10-12 21:47:51 +08:00
|
|
|
#ifdef CONFIG_OF_MDIO
|
|
|
|
struct vsc8531_edge_rate_table {
|
2018-09-03 16:48:49 +08:00
|
|
|
u32 vddmac;
|
2018-09-03 16:48:50 +08:00
|
|
|
u32 slowdown[8];
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
};
|
|
|
|
|
2016-10-12 21:47:51 +08:00
|
|
|
static const struct vsc8531_edge_rate_table edge_table[] = {
|
|
|
|
{MSCC_VDDMAC_3300, { 0, 2, 4, 7, 10, 17, 29, 53} },
|
|
|
|
{MSCC_VDDMAC_2500, { 0, 3, 6, 10, 14, 23, 37, 63} },
|
|
|
|
{MSCC_VDDMAC_1800, { 0, 5, 9, 16, 23, 35, 52, 76} },
|
|
|
|
{MSCC_VDDMAC_1500, { 0, 6, 14, 21, 29, 42, 58, 77} },
|
|
|
|
};
|
|
|
|
#endif /* CONFIG_OF_MDIO */
|
|
|
|
|
2018-10-08 18:07:23 +08:00
|
|
|
static int vsc85xx_phy_read_page(struct phy_device *phydev)
|
2016-08-05 20:24:21 +08:00
|
|
|
{
|
2018-10-08 18:07:23 +08:00
|
|
|
return __phy_read(phydev, MSCC_EXT_PAGE_ACCESS);
|
|
|
|
}
|
2016-08-05 20:24:21 +08:00
|
|
|
|
2018-10-08 18:07:23 +08:00
|
|
|
static int vsc85xx_phy_write_page(struct phy_device *phydev, int page)
|
|
|
|
{
|
|
|
|
return __phy_write(phydev, MSCC_EXT_PAGE_ACCESS, page);
|
2016-08-05 20:24:21 +08:00
|
|
|
}
|
|
|
|
|
2018-10-08 18:07:24 +08:00
|
|
|
static int vsc85xx_get_sset_count(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
struct vsc8531_private *priv = phydev->priv;
|
|
|
|
|
|
|
|
if (!priv)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return priv->nstats;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void vsc85xx_get_strings(struct phy_device *phydev, u8 *data)
|
|
|
|
{
|
|
|
|
struct vsc8531_private *priv = phydev->priv;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!priv)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < priv->nstats; i++)
|
|
|
|
strlcpy(data + i * ETH_GSTRING_LEN, priv->hw_stats[i].string,
|
|
|
|
ETH_GSTRING_LEN);
|
|
|
|
}
|
|
|
|
|
|
|
|
static u64 vsc85xx_get_stat(struct phy_device *phydev, int i)
|
|
|
|
{
|
|
|
|
struct vsc8531_private *priv = phydev->priv;
|
|
|
|
int val;
|
|
|
|
|
|
|
|
val = phy_read_paged(phydev, priv->hw_stats[i].page,
|
|
|
|
priv->hw_stats[i].reg);
|
|
|
|
if (val < 0)
|
|
|
|
return U64_MAX;
|
|
|
|
|
|
|
|
val = val & priv->hw_stats[i].mask;
|
|
|
|
priv->stats[i] += val;
|
|
|
|
|
|
|
|
return priv->stats[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
static void vsc85xx_get_stats(struct phy_device *phydev,
|
|
|
|
struct ethtool_stats *stats, u64 *data)
|
|
|
|
{
|
|
|
|
struct vsc8531_private *priv = phydev->priv;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!priv)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < priv->nstats; i++)
|
|
|
|
data[i] = vsc85xx_get_stat(phydev, i);
|
|
|
|
}
|
|
|
|
|
2017-02-07 21:40:26 +08:00
|
|
|
static int vsc85xx_led_cntl_set(struct phy_device *phydev,
|
|
|
|
u8 led_num,
|
|
|
|
u8 mode)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
u16 reg_val;
|
|
|
|
|
|
|
|
mutex_lock(&phydev->lock);
|
|
|
|
reg_val = phy_read(phydev, MSCC_PHY_LED_MODE_SEL);
|
2018-09-03 16:48:47 +08:00
|
|
|
reg_val &= ~LED_MODE_SEL_MASK(led_num);
|
|
|
|
reg_val |= LED_MODE_SEL(led_num, (u16)mode);
|
2017-02-07 21:40:26 +08:00
|
|
|
rc = phy_write(phydev, MSCC_PHY_LED_MODE_SEL, reg_val);
|
|
|
|
mutex_unlock(&phydev->lock);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2016-11-29 17:46:48 +08:00
|
|
|
static int vsc85xx_mdix_get(struct phy_device *phydev, u8 *mdix)
|
|
|
|
{
|
|
|
|
u16 reg_val;
|
|
|
|
|
|
|
|
reg_val = phy_read(phydev, MSCC_PHY_DEV_AUX_CNTL);
|
|
|
|
if (reg_val & HP_AUTO_MDIX_X_OVER_IND_MASK)
|
|
|
|
*mdix = ETH_TP_MDI_X;
|
|
|
|
else
|
|
|
|
*mdix = ETH_TP_MDI;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int vsc85xx_mdix_set(struct phy_device *phydev, u8 mdix)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
u16 reg_val;
|
|
|
|
|
|
|
|
reg_val = phy_read(phydev, MSCC_PHY_BYPASS_CONTROL);
|
2018-10-08 18:07:26 +08:00
|
|
|
if (mdix == ETH_TP_MDI || mdix == ETH_TP_MDI_X) {
|
2016-11-29 17:46:48 +08:00
|
|
|
reg_val |= (DISABLE_PAIR_SWAP_CORR_MASK |
|
|
|
|
DISABLE_POLARITY_CORR_MASK |
|
|
|
|
DISABLE_HP_AUTO_MDIX_MASK);
|
|
|
|
} else {
|
|
|
|
reg_val &= ~(DISABLE_PAIR_SWAP_CORR_MASK |
|
|
|
|
DISABLE_POLARITY_CORR_MASK |
|
|
|
|
DISABLE_HP_AUTO_MDIX_MASK);
|
|
|
|
}
|
|
|
|
rc = phy_write(phydev, MSCC_PHY_BYPASS_CONTROL, reg_val);
|
2018-10-08 18:07:27 +08:00
|
|
|
if (rc)
|
2016-11-29 17:46:48 +08:00
|
|
|
return rc;
|
|
|
|
|
2018-10-08 18:07:23 +08:00
|
|
|
reg_val = 0;
|
2016-11-29 17:46:48 +08:00
|
|
|
|
|
|
|
if (mdix == ETH_TP_MDI)
|
2018-10-08 18:07:23 +08:00
|
|
|
reg_val = FORCE_MDI_CROSSOVER_MDI;
|
2016-11-29 17:46:48 +08:00
|
|
|
else if (mdix == ETH_TP_MDI_X)
|
2018-10-08 18:07:23 +08:00
|
|
|
reg_val = FORCE_MDI_CROSSOVER_MDIX;
|
2016-11-29 17:46:48 +08:00
|
|
|
|
2018-10-08 18:07:23 +08:00
|
|
|
rc = phy_modify_paged(phydev, MSCC_PHY_PAGE_EXTENDED,
|
|
|
|
MSCC_PHY_EXT_MODE_CNTL, FORCE_MDI_CROSSOVER_MASK,
|
|
|
|
reg_val);
|
|
|
|
if (rc < 0)
|
2016-11-29 17:46:48 +08:00
|
|
|
return rc;
|
|
|
|
|
|
|
|
return genphy_restart_aneg(phydev);
|
|
|
|
}
|
|
|
|
|
2016-11-17 20:07:24 +08:00
|
|
|
static int vsc85xx_downshift_get(struct phy_device *phydev, u8 *count)
|
|
|
|
{
|
|
|
|
u16 reg_val;
|
|
|
|
|
2018-10-08 18:07:23 +08:00
|
|
|
reg_val = phy_read_paged(phydev, MSCC_PHY_PAGE_EXTENDED,
|
|
|
|
MSCC_PHY_ACTIPHY_CNTL);
|
|
|
|
if (reg_val < 0)
|
|
|
|
return reg_val;
|
2016-11-17 20:07:24 +08:00
|
|
|
|
|
|
|
reg_val &= DOWNSHIFT_CNTL_MASK;
|
|
|
|
if (!(reg_val & DOWNSHIFT_EN))
|
|
|
|
*count = DOWNSHIFT_DEV_DISABLE;
|
|
|
|
else
|
|
|
|
*count = ((reg_val & ~DOWNSHIFT_EN) >> DOWNSHIFT_CNTL_POS) + 2;
|
|
|
|
|
2018-10-08 18:07:23 +08:00
|
|
|
return 0;
|
2016-11-17 20:07:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int vsc85xx_downshift_set(struct phy_device *phydev, u8 count)
|
|
|
|
{
|
|
|
|
if (count == DOWNSHIFT_DEV_DEFAULT_COUNT) {
|
|
|
|
/* Default downshift count 3 (i.e. Bit3:2 = 0b01) */
|
|
|
|
count = ((1 << DOWNSHIFT_CNTL_POS) | DOWNSHIFT_EN);
|
|
|
|
} else if (count > DOWNSHIFT_COUNT_MAX || count == 1) {
|
|
|
|
phydev_err(phydev, "Downshift count should be 2,3,4 or 5\n");
|
|
|
|
return -ERANGE;
|
|
|
|
} else if (count) {
|
|
|
|
/* Downshift count is either 2,3,4 or 5 */
|
|
|
|
count = (((count - 2) << DOWNSHIFT_CNTL_POS) | DOWNSHIFT_EN);
|
|
|
|
}
|
|
|
|
|
2018-10-08 18:07:23 +08:00
|
|
|
return phy_modify_paged(phydev, MSCC_PHY_PAGE_EXTENDED,
|
|
|
|
MSCC_PHY_ACTIPHY_CNTL, DOWNSHIFT_CNTL_MASK,
|
|
|
|
count);
|
2016-11-17 20:07:24 +08:00
|
|
|
}
|
|
|
|
|
2016-10-05 16:49:27 +08:00
|
|
|
static int vsc85xx_wol_set(struct phy_device *phydev,
|
|
|
|
struct ethtool_wolinfo *wol)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
u16 reg_val;
|
|
|
|
u8 i;
|
|
|
|
u16 pwd[3] = {0, 0, 0};
|
|
|
|
struct ethtool_wolinfo *wol_conf = wol;
|
|
|
|
u8 *mac_addr = phydev->attached_dev->dev_addr;
|
|
|
|
|
|
|
|
mutex_lock(&phydev->lock);
|
2018-10-08 18:07:23 +08:00
|
|
|
rc = phy_select_page(phydev, MSCC_PHY_PAGE_EXTENDED_2);
|
|
|
|
if (rc < 0) {
|
|
|
|
rc = phy_restore_page(phydev, rc, rc);
|
2016-10-05 16:49:27 +08:00
|
|
|
goto out_unlock;
|
2018-10-08 18:07:23 +08:00
|
|
|
}
|
2016-10-05 16:49:27 +08:00
|
|
|
|
|
|
|
if (wol->wolopts & WAKE_MAGIC) {
|
|
|
|
/* Store the device address for the magic packet */
|
|
|
|
for (i = 0; i < ARRAY_SIZE(pwd); i++)
|
|
|
|
pwd[i] = mac_addr[5 - (i * 2 + 1)] << 8 |
|
|
|
|
mac_addr[5 - i * 2];
|
2018-10-08 18:07:23 +08:00
|
|
|
__phy_write(phydev, MSCC_PHY_WOL_LOWER_MAC_ADDR, pwd[0]);
|
|
|
|
__phy_write(phydev, MSCC_PHY_WOL_MID_MAC_ADDR, pwd[1]);
|
|
|
|
__phy_write(phydev, MSCC_PHY_WOL_UPPER_MAC_ADDR, pwd[2]);
|
2016-10-05 16:49:27 +08:00
|
|
|
} else {
|
2018-10-08 18:07:23 +08:00
|
|
|
__phy_write(phydev, MSCC_PHY_WOL_LOWER_MAC_ADDR, 0);
|
|
|
|
__phy_write(phydev, MSCC_PHY_WOL_MID_MAC_ADDR, 0);
|
|
|
|
__phy_write(phydev, MSCC_PHY_WOL_UPPER_MAC_ADDR, 0);
|
2016-10-05 16:49:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (wol_conf->wolopts & WAKE_MAGICSECURE) {
|
|
|
|
for (i = 0; i < ARRAY_SIZE(pwd); i++)
|
|
|
|
pwd[i] = wol_conf->sopass[5 - (i * 2 + 1)] << 8 |
|
|
|
|
wol_conf->sopass[5 - i * 2];
|
2018-10-08 18:07:23 +08:00
|
|
|
__phy_write(phydev, MSCC_PHY_WOL_LOWER_PASSWD, pwd[0]);
|
|
|
|
__phy_write(phydev, MSCC_PHY_WOL_MID_PASSWD, pwd[1]);
|
|
|
|
__phy_write(phydev, MSCC_PHY_WOL_UPPER_PASSWD, pwd[2]);
|
2016-10-05 16:49:27 +08:00
|
|
|
} else {
|
2018-10-08 18:07:23 +08:00
|
|
|
__phy_write(phydev, MSCC_PHY_WOL_LOWER_PASSWD, 0);
|
|
|
|
__phy_write(phydev, MSCC_PHY_WOL_MID_PASSWD, 0);
|
|
|
|
__phy_write(phydev, MSCC_PHY_WOL_UPPER_PASSWD, 0);
|
2016-10-05 16:49:27 +08:00
|
|
|
}
|
|
|
|
|
2018-10-08 18:07:23 +08:00
|
|
|
reg_val = __phy_read(phydev, MSCC_PHY_WOL_MAC_CONTROL);
|
2016-10-05 16:49:27 +08:00
|
|
|
if (wol_conf->wolopts & WAKE_MAGICSECURE)
|
|
|
|
reg_val |= SECURE_ON_ENABLE;
|
|
|
|
else
|
|
|
|
reg_val &= ~SECURE_ON_ENABLE;
|
2018-10-08 18:07:23 +08:00
|
|
|
__phy_write(phydev, MSCC_PHY_WOL_MAC_CONTROL, reg_val);
|
2016-10-05 16:49:27 +08:00
|
|
|
|
2018-10-08 18:07:23 +08:00
|
|
|
rc = phy_restore_page(phydev, rc, rc > 0 ? 0 : rc);
|
|
|
|
if (rc < 0)
|
2016-10-05 16:49:27 +08:00
|
|
|
goto out_unlock;
|
|
|
|
|
|
|
|
if (wol->wolopts & WAKE_MAGIC) {
|
|
|
|
/* Enable the WOL interrupt */
|
|
|
|
reg_val = phy_read(phydev, MII_VSC85XX_INT_MASK);
|
|
|
|
reg_val |= MII_VSC85XX_INT_MASK_WOL;
|
|
|
|
rc = phy_write(phydev, MII_VSC85XX_INT_MASK, reg_val);
|
2018-10-08 18:07:27 +08:00
|
|
|
if (rc)
|
2016-10-05 16:49:27 +08:00
|
|
|
goto out_unlock;
|
|
|
|
} else {
|
|
|
|
/* Disable the WOL interrupt */
|
|
|
|
reg_val = phy_read(phydev, MII_VSC85XX_INT_MASK);
|
|
|
|
reg_val &= (~MII_VSC85XX_INT_MASK_WOL);
|
|
|
|
rc = phy_write(phydev, MII_VSC85XX_INT_MASK, reg_val);
|
2018-10-08 18:07:27 +08:00
|
|
|
if (rc)
|
2016-10-05 16:49:27 +08:00
|
|
|
goto out_unlock;
|
|
|
|
}
|
|
|
|
/* Clear WOL iterrupt status */
|
|
|
|
reg_val = phy_read(phydev, MII_VSC85XX_INT_STATUS);
|
|
|
|
|
|
|
|
out_unlock:
|
|
|
|
mutex_unlock(&phydev->lock);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void vsc85xx_wol_get(struct phy_device *phydev,
|
|
|
|
struct ethtool_wolinfo *wol)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
u16 reg_val;
|
|
|
|
u8 i;
|
|
|
|
u16 pwd[3] = {0, 0, 0};
|
|
|
|
struct ethtool_wolinfo *wol_conf = wol;
|
|
|
|
|
|
|
|
mutex_lock(&phydev->lock);
|
2018-10-08 18:07:23 +08:00
|
|
|
rc = phy_select_page(phydev, MSCC_PHY_PAGE_EXTENDED_2);
|
|
|
|
if (rc < 0)
|
2016-10-05 16:49:27 +08:00
|
|
|
goto out_unlock;
|
|
|
|
|
2018-10-08 18:07:23 +08:00
|
|
|
reg_val = __phy_read(phydev, MSCC_PHY_WOL_MAC_CONTROL);
|
2016-10-05 16:49:27 +08:00
|
|
|
if (reg_val & SECURE_ON_ENABLE)
|
|
|
|
wol_conf->wolopts |= WAKE_MAGICSECURE;
|
|
|
|
if (wol_conf->wolopts & WAKE_MAGICSECURE) {
|
2018-10-08 18:07:23 +08:00
|
|
|
pwd[0] = __phy_read(phydev, MSCC_PHY_WOL_LOWER_PASSWD);
|
|
|
|
pwd[1] = __phy_read(phydev, MSCC_PHY_WOL_MID_PASSWD);
|
|
|
|
pwd[2] = __phy_read(phydev, MSCC_PHY_WOL_UPPER_PASSWD);
|
2016-10-05 16:49:27 +08:00
|
|
|
for (i = 0; i < ARRAY_SIZE(pwd); i++) {
|
|
|
|
wol_conf->sopass[5 - i * 2] = pwd[i] & 0x00ff;
|
|
|
|
wol_conf->sopass[5 - (i * 2 + 1)] = (pwd[i] & 0xff00)
|
|
|
|
>> 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
out_unlock:
|
2018-10-08 18:07:23 +08:00
|
|
|
phy_restore_page(phydev, rc, rc > 0 ? 0 : rc);
|
2016-10-05 16:49:27 +08:00
|
|
|
mutex_unlock(&phydev->lock);
|
|
|
|
}
|
|
|
|
|
2016-10-12 21:47:51 +08:00
|
|
|
#ifdef CONFIG_OF_MDIO
|
|
|
|
static int vsc85xx_edge_rate_magic_get(struct phy_device *phydev)
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
{
|
2018-09-03 16:48:50 +08:00
|
|
|
u32 vdd, sd;
|
2016-10-12 21:47:51 +08:00
|
|
|
int rc, i, j;
|
|
|
|
struct device *dev = &phydev->mdio.dev;
|
|
|
|
struct device_node *of_node = dev->of_node;
|
|
|
|
u8 sd_array_size = ARRAY_SIZE(edge_table[0].slowdown);
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
|
2016-10-12 21:47:51 +08:00
|
|
|
if (!of_node)
|
|
|
|
return -ENODEV;
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
|
2018-09-03 16:48:49 +08:00
|
|
|
rc = of_property_read_u32(of_node, "vsc8531,vddmac", &vdd);
|
2016-10-12 21:47:51 +08:00
|
|
|
if (rc != 0)
|
|
|
|
vdd = MSCC_VDDMAC_3300;
|
|
|
|
|
2018-09-03 16:48:50 +08:00
|
|
|
rc = of_property_read_u32(of_node, "vsc8531,edge-slowdown", &sd);
|
2016-10-12 21:47:51 +08:00
|
|
|
if (rc != 0)
|
|
|
|
sd = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(edge_table); i++)
|
|
|
|
if (edge_table[i].vddmac == vdd)
|
|
|
|
for (j = 0; j < sd_array_size; j++)
|
|
|
|
if (edge_table[i].slowdown[j] == sd)
|
|
|
|
return (sd_array_size - j - 1);
|
|
|
|
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2017-02-07 21:40:26 +08:00
|
|
|
|
|
|
|
static int vsc85xx_dt_led_mode_get(struct phy_device *phydev,
|
|
|
|
char *led,
|
2018-09-03 16:48:51 +08:00
|
|
|
u32 default_mode)
|
2017-02-07 21:40:26 +08:00
|
|
|
{
|
2018-09-03 16:48:48 +08:00
|
|
|
struct vsc8531_private *priv = phydev->priv;
|
2017-02-07 21:40:26 +08:00
|
|
|
struct device *dev = &phydev->mdio.dev;
|
|
|
|
struct device_node *of_node = dev->of_node;
|
2018-09-03 16:48:51 +08:00
|
|
|
u32 led_mode;
|
2017-02-07 21:40:26 +08:00
|
|
|
int err;
|
|
|
|
|
|
|
|
if (!of_node)
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
led_mode = default_mode;
|
2018-09-03 16:48:51 +08:00
|
|
|
err = of_property_read_u32(of_node, led, &led_mode);
|
2018-09-03 16:48:48 +08:00
|
|
|
if (!err && !(BIT(led_mode) & priv->supp_led_modes)) {
|
2017-02-07 21:40:26 +08:00
|
|
|
phydev_err(phydev, "DT %s invalid\n", led);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return led_mode;
|
|
|
|
}
|
|
|
|
|
2016-10-12 21:47:51 +08:00
|
|
|
#else
|
|
|
|
static int vsc85xx_edge_rate_magic_get(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
return 0;
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
}
|
2017-02-07 21:40:26 +08:00
|
|
|
|
|
|
|
static int vsc85xx_dt_led_mode_get(struct phy_device *phydev,
|
|
|
|
char *led,
|
|
|
|
u8 default_mode)
|
|
|
|
{
|
|
|
|
return default_mode;
|
|
|
|
}
|
2016-10-12 21:47:51 +08:00
|
|
|
#endif /* CONFIG_OF_MDIO */
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
|
2018-09-03 16:48:51 +08:00
|
|
|
static int vsc85xx_dt_led_modes_get(struct phy_device *phydev,
|
|
|
|
u32 *default_mode)
|
2018-09-03 16:48:47 +08:00
|
|
|
{
|
|
|
|
struct vsc8531_private *priv = phydev->priv;
|
2018-09-26 21:20:11 +08:00
|
|
|
char led_dt_prop[28];
|
2018-09-03 16:48:47 +08:00
|
|
|
int i, ret;
|
|
|
|
|
|
|
|
for (i = 0; i < priv->nleds; i++) {
|
|
|
|
ret = sprintf(led_dt_prop, "vsc8531,led-%d-mode", i);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = vsc85xx_dt_led_mode_get(phydev, led_dt_prop,
|
|
|
|
default_mode[i]);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
priv->leds_mode[i] = ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-10-12 21:47:51 +08:00
|
|
|
static int vsc85xx_edge_rate_cntl_set(struct phy_device *phydev, u8 edge_rate)
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
mutex_lock(&phydev->lock);
|
2018-10-08 18:07:23 +08:00
|
|
|
rc = phy_modify_paged(phydev, MSCC_PHY_PAGE_EXTENDED_2,
|
|
|
|
MSCC_PHY_WOL_MAC_CONTROL, EDGE_RATE_CNTL_MASK,
|
|
|
|
edge_rate << EDGE_RATE_CNTL_POS);
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
mutex_unlock(&phydev->lock);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2016-09-19 18:03:54 +08:00
|
|
|
static int vsc85xx_mac_if_set(struct phy_device *phydev,
|
|
|
|
phy_interface_t interface)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
u16 reg_val;
|
|
|
|
|
|
|
|
mutex_lock(&phydev->lock);
|
|
|
|
reg_val = phy_read(phydev, MSCC_PHY_EXT_PHY_CNTL_1);
|
|
|
|
reg_val &= ~(MAC_IF_SELECTION_MASK);
|
|
|
|
switch (interface) {
|
|
|
|
case PHY_INTERFACE_MODE_RGMII:
|
|
|
|
reg_val |= (MAC_IF_SELECTION_RGMII << MAC_IF_SELECTION_POS);
|
|
|
|
break;
|
|
|
|
case PHY_INTERFACE_MODE_RMII:
|
|
|
|
reg_val |= (MAC_IF_SELECTION_RMII << MAC_IF_SELECTION_POS);
|
|
|
|
break;
|
|
|
|
case PHY_INTERFACE_MODE_MII:
|
|
|
|
case PHY_INTERFACE_MODE_GMII:
|
|
|
|
reg_val |= (MAC_IF_SELECTION_GMII << MAC_IF_SELECTION_POS);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
rc = -EINVAL;
|
|
|
|
goto out_unlock;
|
|
|
|
}
|
|
|
|
rc = phy_write(phydev, MSCC_PHY_EXT_PHY_CNTL_1, reg_val);
|
2018-10-08 18:07:27 +08:00
|
|
|
if (rc)
|
2016-09-19 18:03:54 +08:00
|
|
|
goto out_unlock;
|
|
|
|
|
|
|
|
rc = genphy_soft_reset(phydev);
|
|
|
|
|
|
|
|
out_unlock:
|
|
|
|
mutex_unlock(&phydev->lock);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2016-08-05 20:24:21 +08:00
|
|
|
static int vsc85xx_default_config(struct phy_device *phydev)
|
|
|
|
{
|
2016-09-08 16:39:31 +08:00
|
|
|
int rc;
|
|
|
|
u16 reg_val;
|
2016-08-05 20:24:21 +08:00
|
|
|
|
2016-11-29 17:46:48 +08:00
|
|
|
phydev->mdix_ctrl = ETH_TP_MDI_AUTO;
|
2016-09-08 16:39:31 +08:00
|
|
|
mutex_lock(&phydev->lock);
|
2018-10-08 18:07:23 +08:00
|
|
|
rc = phy_select_page(phydev, MSCC_PHY_PAGE_EXTENDED_2);
|
|
|
|
if (rc < 0)
|
2016-09-08 16:39:31 +08:00
|
|
|
goto out_unlock;
|
2016-08-05 20:24:21 +08:00
|
|
|
|
2016-09-08 16:39:31 +08:00
|
|
|
reg_val = phy_read(phydev, MSCC_PHY_RGMII_CNTL);
|
|
|
|
reg_val &= ~(RGMII_RX_CLK_DELAY_MASK);
|
|
|
|
reg_val |= (RGMII_RX_CLK_DELAY_1_1_NS << RGMII_RX_CLK_DELAY_POS);
|
|
|
|
phy_write(phydev, MSCC_PHY_RGMII_CNTL, reg_val);
|
2016-08-05 20:24:21 +08:00
|
|
|
|
|
|
|
out_unlock:
|
2018-10-08 18:07:23 +08:00
|
|
|
rc = phy_restore_page(phydev, rc, rc > 0 ? 0 : rc);
|
2016-09-08 16:39:31 +08:00
|
|
|
mutex_unlock(&phydev->lock);
|
2016-08-05 20:24:21 +08:00
|
|
|
|
2016-09-08 16:39:31 +08:00
|
|
|
return rc;
|
2016-08-05 20:24:21 +08:00
|
|
|
}
|
|
|
|
|
2016-11-17 20:07:24 +08:00
|
|
|
static int vsc85xx_get_tunable(struct phy_device *phydev,
|
|
|
|
struct ethtool_tunable *tuna, void *data)
|
|
|
|
{
|
|
|
|
switch (tuna->id) {
|
|
|
|
case ETHTOOL_PHY_DOWNSHIFT:
|
|
|
|
return vsc85xx_downshift_get(phydev, (u8 *)data);
|
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int vsc85xx_set_tunable(struct phy_device *phydev,
|
|
|
|
struct ethtool_tunable *tuna,
|
|
|
|
const void *data)
|
|
|
|
{
|
|
|
|
switch (tuna->id) {
|
|
|
|
case ETHTOOL_PHY_DOWNSHIFT:
|
|
|
|
return vsc85xx_downshift_set(phydev, *(u8 *)data);
|
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-08 18:07:25 +08:00
|
|
|
/* mdiobus lock should be locked when using this function */
|
|
|
|
static void vsc85xx_tr_write(struct phy_device *phydev, u16 addr, u32 val)
|
|
|
|
{
|
|
|
|
__phy_write(phydev, MSCC_PHY_TR_MSB, val >> 16);
|
|
|
|
__phy_write(phydev, MSCC_PHY_TR_LSB, val & GENMASK(15, 0));
|
|
|
|
__phy_write(phydev, MSCC_PHY_TR_CNTL, TR_WRITE | TR_ADDR(addr));
|
|
|
|
}
|
|
|
|
|
|
|
|
static int vsc85xx_eee_init_seq_set(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
const struct reg_val init_eee[] = {
|
|
|
|
{0x0f82, 0x0012b00a},
|
|
|
|
{0x1686, 0x00000004},
|
|
|
|
{0x168c, 0x00d2c46f},
|
|
|
|
{0x17a2, 0x00000620},
|
|
|
|
{0x16a0, 0x00eeffdd},
|
|
|
|
{0x16a6, 0x00071448},
|
|
|
|
{0x16a4, 0x0013132f},
|
|
|
|
{0x16a8, 0x00000000},
|
|
|
|
{0x0ffc, 0x00c0a028},
|
|
|
|
{0x0fe8, 0x0091b06c},
|
|
|
|
{0x0fea, 0x00041600},
|
|
|
|
{0x0f80, 0x00000af4},
|
|
|
|
{0x0fec, 0x00901809},
|
|
|
|
{0x0fee, 0x0000a6a1},
|
|
|
|
{0x0ffe, 0x00b01007},
|
|
|
|
{0x16b0, 0x00eeff00},
|
|
|
|
{0x16b2, 0x00007000},
|
|
|
|
{0x16b4, 0x00000814},
|
|
|
|
};
|
|
|
|
unsigned int i;
|
|
|
|
int oldpage;
|
|
|
|
|
|
|
|
mutex_lock(&phydev->lock);
|
|
|
|
oldpage = phy_select_page(phydev, MSCC_PHY_PAGE_TR);
|
|
|
|
if (oldpage < 0)
|
|
|
|
goto out_unlock;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(init_eee); i++)
|
|
|
|
vsc85xx_tr_write(phydev, init_eee[i].reg, init_eee[i].val);
|
|
|
|
|
|
|
|
out_unlock:
|
|
|
|
oldpage = phy_restore_page(phydev, oldpage, oldpage);
|
|
|
|
mutex_unlock(&phydev->lock);
|
|
|
|
|
|
|
|
return oldpage;
|
|
|
|
}
|
|
|
|
|
2016-08-05 20:24:21 +08:00
|
|
|
static int vsc85xx_config_init(struct phy_device *phydev)
|
|
|
|
{
|
2018-09-03 16:48:47 +08:00
|
|
|
int rc, i;
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
struct vsc8531_private *vsc8531 = phydev->priv;
|
2016-08-05 20:24:21 +08:00
|
|
|
|
2016-09-08 16:39:31 +08:00
|
|
|
rc = vsc85xx_default_config(phydev);
|
|
|
|
if (rc)
|
|
|
|
return rc;
|
2016-09-19 18:03:54 +08:00
|
|
|
|
|
|
|
rc = vsc85xx_mac_if_set(phydev, phydev->interface);
|
|
|
|
if (rc)
|
|
|
|
return rc;
|
|
|
|
|
2016-10-12 21:47:51 +08:00
|
|
|
rc = vsc85xx_edge_rate_cntl_set(phydev, vsc8531->rate_magic);
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
if (rc)
|
|
|
|
return rc;
|
|
|
|
|
2018-10-08 18:07:25 +08:00
|
|
|
rc = vsc85xx_eee_init_seq_set(phydev);
|
|
|
|
if (rc)
|
|
|
|
return rc;
|
|
|
|
|
2018-09-03 16:48:47 +08:00
|
|
|
for (i = 0; i < vsc8531->nleds; i++) {
|
|
|
|
rc = vsc85xx_led_cntl_set(phydev, i, vsc8531->leds_mode[i]);
|
|
|
|
if (rc)
|
|
|
|
return rc;
|
|
|
|
}
|
2017-02-07 21:40:26 +08:00
|
|
|
|
2016-09-08 16:39:31 +08:00
|
|
|
rc = genphy_config_init(phydev);
|
2016-08-05 20:24:21 +08:00
|
|
|
|
2016-09-08 16:39:31 +08:00
|
|
|
return rc;
|
2016-08-05 20:24:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int vsc85xx_ack_interrupt(struct phy_device *phydev)
|
|
|
|
{
|
2016-09-08 16:39:31 +08:00
|
|
|
int rc = 0;
|
2016-08-05 20:24:21 +08:00
|
|
|
|
2016-09-08 16:39:31 +08:00
|
|
|
if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
|
|
|
|
rc = phy_read(phydev, MII_VSC85XX_INT_STATUS);
|
2016-08-05 20:24:21 +08:00
|
|
|
|
2016-09-08 16:39:31 +08:00
|
|
|
return (rc < 0) ? rc : 0;
|
2016-08-05 20:24:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int vsc85xx_config_intr(struct phy_device *phydev)
|
|
|
|
{
|
2016-09-08 16:39:31 +08:00
|
|
|
int rc;
|
|
|
|
|
|
|
|
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
|
|
|
|
rc = phy_write(phydev, MII_VSC85XX_INT_MASK,
|
|
|
|
MII_VSC85XX_INT_MASK_MASK);
|
|
|
|
} else {
|
|
|
|
rc = phy_write(phydev, MII_VSC85XX_INT_MASK, 0);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
rc = phy_read(phydev, MII_VSC85XX_INT_STATUS);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
2016-08-05 20:24:21 +08:00
|
|
|
}
|
|
|
|
|
2016-11-29 17:46:48 +08:00
|
|
|
static int vsc85xx_config_aneg(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = vsc85xx_mdix_set(phydev, phydev->mdix_ctrl);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
return genphy_config_aneg(phydev);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int vsc85xx_read_status(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = vsc85xx_mdix_get(phydev, &phydev->mdix);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
return genphy_read_status(phydev);
|
|
|
|
}
|
|
|
|
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
static int vsc85xx_probe(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
struct vsc8531_private *vsc8531;
|
2017-02-07 21:40:26 +08:00
|
|
|
int rate_magic;
|
2018-09-03 16:48:51 +08:00
|
|
|
u32 default_mode[2] = {VSC8531_LINK_1000_ACTIVITY,
|
2018-09-03 16:48:47 +08:00
|
|
|
VSC8531_LINK_100_ACTIVITY};
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
|
2016-10-12 21:47:51 +08:00
|
|
|
rate_magic = vsc85xx_edge_rate_magic_get(phydev);
|
|
|
|
if (rate_magic < 0)
|
|
|
|
return rate_magic;
|
|
|
|
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL);
|
|
|
|
if (!vsc8531)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
phydev->priv = vsc8531;
|
|
|
|
|
2016-10-12 21:47:51 +08:00
|
|
|
vsc8531->rate_magic = rate_magic;
|
2018-09-03 16:48:47 +08:00
|
|
|
vsc8531->nleds = 2;
|
2018-09-03 16:48:48 +08:00
|
|
|
vsc8531->supp_led_modes = VSC85XX_SUPP_LED_MODES;
|
2018-10-08 18:07:24 +08:00
|
|
|
vsc8531->hw_stats = vsc85xx_hw_stats;
|
|
|
|
vsc8531->nstats = ARRAY_SIZE(vsc85xx_hw_stats);
|
|
|
|
vsc8531->stats = devm_kmalloc_array(&phydev->mdio.dev, vsc8531->nstats,
|
|
|
|
sizeof(u64), GFP_KERNEL);
|
|
|
|
if (!vsc8531->stats)
|
|
|
|
return -ENOMEM;
|
2016-10-12 21:47:51 +08:00
|
|
|
|
2018-09-03 16:48:47 +08:00
|
|
|
return vsc85xx_dt_led_modes_get(phydev, default_mode);
|
net: phy: Add Edge-rate driver for Microsemi PHYs.
Edge-rate:
As system and networking speeds increase, a signal's output transition,
also know as the edge rate or slew rate (V/ns), takes on greater importance
because high-speed signals come with a price. That price is an assortment of
interference problems like ringing on the line, signal overshoot and
undershoot, extended signal settling times, crosstalk noise, transmission
line reflections, false signal detection by the receiving device and
electromagnetic interference (EMI) -- all of which can negate the potential
gains designers are seeking when they try to increase system speeds through
the use of higher performance logic devices. The fact is, faster signaling
edge rates can cause a higher level of electrical noise or other type of
interference that can actually lead to slower line speeds and lower maximum
system frequencies. This parameter allow the board designers to change the
driving strange, and thereby change the EMI behavioral.
Edge-rate parameters (vddmac, edge-slowdown) get from Device Tree.
Tested on Beaglebone Black with VSC 8531 PHY.
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-03 15:23:13 +08:00
|
|
|
}
|
|
|
|
|
2016-08-05 20:24:21 +08:00
|
|
|
/* Microsemi VSC85xx PHYs */
|
|
|
|
static struct phy_driver vsc85xx_driver[] = {
|
2016-10-28 18:10:11 +08:00
|
|
|
{
|
|
|
|
.phy_id = PHY_ID_VSC8530,
|
|
|
|
.name = "Microsemi FE VSC8530",
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.features = PHY_BASIC_FEATURES,
|
|
|
|
.flags = PHY_HAS_INTERRUPT,
|
|
|
|
.soft_reset = &genphy_soft_reset,
|
|
|
|
.config_init = &vsc85xx_config_init,
|
2016-11-29 17:46:48 +08:00
|
|
|
.config_aneg = &vsc85xx_config_aneg,
|
2016-10-28 18:10:11 +08:00
|
|
|
.aneg_done = &genphy_aneg_done,
|
2016-11-29 17:46:48 +08:00
|
|
|
.read_status = &vsc85xx_read_status,
|
2016-10-28 18:10:11 +08:00
|
|
|
.ack_interrupt = &vsc85xx_ack_interrupt,
|
|
|
|
.config_intr = &vsc85xx_config_intr,
|
|
|
|
.suspend = &genphy_suspend,
|
|
|
|
.resume = &genphy_resume,
|
|
|
|
.probe = &vsc85xx_probe,
|
|
|
|
.set_wol = &vsc85xx_wol_set,
|
|
|
|
.get_wol = &vsc85xx_wol_get,
|
2016-11-17 20:07:24 +08:00
|
|
|
.get_tunable = &vsc85xx_get_tunable,
|
|
|
|
.set_tunable = &vsc85xx_set_tunable,
|
2018-10-08 18:07:23 +08:00
|
|
|
.read_page = &vsc85xx_phy_read_page,
|
|
|
|
.write_page = &vsc85xx_phy_write_page,
|
2018-10-08 18:07:24 +08:00
|
|
|
.get_sset_count = &vsc85xx_get_sset_count,
|
|
|
|
.get_strings = &vsc85xx_get_strings,
|
|
|
|
.get_stats = &vsc85xx_get_stats,
|
2016-10-28 18:10:11 +08:00
|
|
|
},
|
2016-08-05 20:24:21 +08:00
|
|
|
{
|
2016-09-08 16:39:31 +08:00
|
|
|
.phy_id = PHY_ID_VSC8531,
|
|
|
|
.name = "Microsemi VSC8531",
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.features = PHY_GBIT_FEATURES,
|
|
|
|
.flags = PHY_HAS_INTERRUPT,
|
|
|
|
.soft_reset = &genphy_soft_reset,
|
|
|
|
.config_init = &vsc85xx_config_init,
|
2016-11-29 17:46:48 +08:00
|
|
|
.config_aneg = &vsc85xx_config_aneg,
|
2016-09-08 16:39:31 +08:00
|
|
|
.aneg_done = &genphy_aneg_done,
|
2016-11-29 17:46:48 +08:00
|
|
|
.read_status = &vsc85xx_read_status,
|
2016-09-08 16:39:31 +08:00
|
|
|
.ack_interrupt = &vsc85xx_ack_interrupt,
|
|
|
|
.config_intr = &vsc85xx_config_intr,
|
|
|
|
.suspend = &genphy_suspend,
|
|
|
|
.resume = &genphy_resume,
|
2016-10-12 21:47:51 +08:00
|
|
|
.probe = &vsc85xx_probe,
|
|
|
|
.set_wol = &vsc85xx_wol_set,
|
|
|
|
.get_wol = &vsc85xx_wol_get,
|
2016-11-17 20:07:24 +08:00
|
|
|
.get_tunable = &vsc85xx_get_tunable,
|
|
|
|
.set_tunable = &vsc85xx_set_tunable,
|
2018-10-08 18:07:23 +08:00
|
|
|
.read_page = &vsc85xx_phy_read_page,
|
|
|
|
.write_page = &vsc85xx_phy_write_page,
|
2018-10-08 18:07:24 +08:00
|
|
|
.get_sset_count = &vsc85xx_get_sset_count,
|
|
|
|
.get_strings = &vsc85xx_get_strings,
|
|
|
|
.get_stats = &vsc85xx_get_stats,
|
2016-08-05 20:24:21 +08:00
|
|
|
},
|
2016-10-28 18:10:11 +08:00
|
|
|
{
|
|
|
|
.phy_id = PHY_ID_VSC8540,
|
|
|
|
.name = "Microsemi FE VSC8540 SyncE",
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.features = PHY_BASIC_FEATURES,
|
|
|
|
.flags = PHY_HAS_INTERRUPT,
|
|
|
|
.soft_reset = &genphy_soft_reset,
|
|
|
|
.config_init = &vsc85xx_config_init,
|
2016-11-29 17:46:48 +08:00
|
|
|
.config_aneg = &vsc85xx_config_aneg,
|
2016-10-28 18:10:11 +08:00
|
|
|
.aneg_done = &genphy_aneg_done,
|
2016-11-29 17:46:48 +08:00
|
|
|
.read_status = &vsc85xx_read_status,
|
2016-10-28 18:10:11 +08:00
|
|
|
.ack_interrupt = &vsc85xx_ack_interrupt,
|
|
|
|
.config_intr = &vsc85xx_config_intr,
|
|
|
|
.suspend = &genphy_suspend,
|
|
|
|
.resume = &genphy_resume,
|
|
|
|
.probe = &vsc85xx_probe,
|
|
|
|
.set_wol = &vsc85xx_wol_set,
|
|
|
|
.get_wol = &vsc85xx_wol_get,
|
2016-11-17 20:07:24 +08:00
|
|
|
.get_tunable = &vsc85xx_get_tunable,
|
|
|
|
.set_tunable = &vsc85xx_set_tunable,
|
2018-10-08 18:07:23 +08:00
|
|
|
.read_page = &vsc85xx_phy_read_page,
|
|
|
|
.write_page = &vsc85xx_phy_write_page,
|
2018-10-08 18:07:24 +08:00
|
|
|
.get_sset_count = &vsc85xx_get_sset_count,
|
|
|
|
.get_strings = &vsc85xx_get_strings,
|
|
|
|
.get_stats = &vsc85xx_get_stats,
|
2016-10-28 18:10:11 +08:00
|
|
|
},
|
2016-08-05 20:24:21 +08:00
|
|
|
{
|
2016-09-08 16:39:31 +08:00
|
|
|
.phy_id = PHY_ID_VSC8541,
|
|
|
|
.name = "Microsemi VSC8541 SyncE",
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.features = PHY_GBIT_FEATURES,
|
|
|
|
.flags = PHY_HAS_INTERRUPT,
|
|
|
|
.soft_reset = &genphy_soft_reset,
|
|
|
|
.config_init = &vsc85xx_config_init,
|
2016-11-29 17:46:48 +08:00
|
|
|
.config_aneg = &vsc85xx_config_aneg,
|
2016-09-08 16:39:31 +08:00
|
|
|
.aneg_done = &genphy_aneg_done,
|
2016-11-29 17:46:48 +08:00
|
|
|
.read_status = &vsc85xx_read_status,
|
2016-09-08 16:39:31 +08:00
|
|
|
.ack_interrupt = &vsc85xx_ack_interrupt,
|
|
|
|
.config_intr = &vsc85xx_config_intr,
|
|
|
|
.suspend = &genphy_suspend,
|
|
|
|
.resume = &genphy_resume,
|
2016-10-12 21:47:51 +08:00
|
|
|
.probe = &vsc85xx_probe,
|
|
|
|
.set_wol = &vsc85xx_wol_set,
|
|
|
|
.get_wol = &vsc85xx_wol_get,
|
2016-11-17 20:07:24 +08:00
|
|
|
.get_tunable = &vsc85xx_get_tunable,
|
|
|
|
.set_tunable = &vsc85xx_set_tunable,
|
2018-10-08 18:07:23 +08:00
|
|
|
.read_page = &vsc85xx_phy_read_page,
|
|
|
|
.write_page = &vsc85xx_phy_write_page,
|
2018-10-08 18:07:24 +08:00
|
|
|
.get_sset_count = &vsc85xx_get_sset_count,
|
|
|
|
.get_strings = &vsc85xx_get_strings,
|
|
|
|
.get_stats = &vsc85xx_get_stats,
|
2016-08-05 20:24:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
module_phy_driver(vsc85xx_driver);
|
|
|
|
|
|
|
|
static struct mdio_device_id __maybe_unused vsc85xx_tbl[] = {
|
2016-10-28 18:10:11 +08:00
|
|
|
{ PHY_ID_VSC8530, 0xfffffff0, },
|
2016-09-08 16:39:31 +08:00
|
|
|
{ PHY_ID_VSC8531, 0xfffffff0, },
|
2016-10-28 18:10:11 +08:00
|
|
|
{ PHY_ID_VSC8540, 0xfffffff0, },
|
2016-09-08 16:39:31 +08:00
|
|
|
{ PHY_ID_VSC8541, 0xfffffff0, },
|
|
|
|
{ }
|
2016-08-05 20:24:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(mdio, vsc85xx_tbl);
|
|
|
|
|
|
|
|
MODULE_DESCRIPTION("Microsemi VSC85xx PHY driver");
|
|
|
|
MODULE_AUTHOR("Nagaraju Lakkaraju");
|
|
|
|
MODULE_LICENSE("Dual MIT/GPL");
|