teranetics.c (9938b04472d5c59f8bd8152a548533a8599596a2) | teranetics.c (aebc78a40b8862e27f374fc7016cd9b4654488ed) |
---|---|
1/* 2 * Driver for Teranetics PHY 3 * 4 * Author: Shaohui Xie <Shaohui.Xie@freescale.com> 5 * 6 * Copyright 2015 Freescale Semiconductor, Inc. 7 * 8 * This file is licensed under the terms of the GNU General Public License --- 20 unchanged lines hidden (view full) --- 29#define MDIO_PHYXS_LNSTAT_ALIGN 0x1000 30 31#define MDIO_PHYXS_LANE_READY (MDIO_PHYXS_LNSTAT_SYNC0 | \ 32 MDIO_PHYXS_LNSTAT_SYNC1 | \ 33 MDIO_PHYXS_LNSTAT_SYNC2 | \ 34 MDIO_PHYXS_LNSTAT_SYNC3 | \ 35 MDIO_PHYXS_LNSTAT_ALIGN) 36 | 1/* 2 * Driver for Teranetics PHY 3 * 4 * Author: Shaohui Xie <Shaohui.Xie@freescale.com> 5 * 6 * Copyright 2015 Freescale Semiconductor, Inc. 7 * 8 * This file is licensed under the terms of the GNU General Public License --- 20 unchanged lines hidden (view full) --- 29#define MDIO_PHYXS_LNSTAT_ALIGN 0x1000 30 31#define MDIO_PHYXS_LANE_READY (MDIO_PHYXS_LNSTAT_SYNC0 | \ 32 MDIO_PHYXS_LNSTAT_SYNC1 | \ 33 MDIO_PHYXS_LNSTAT_SYNC2 | \ 34 MDIO_PHYXS_LNSTAT_SYNC3 | \ 35 MDIO_PHYXS_LNSTAT_ALIGN) 36 |
37static int teranetics_config_init(struct phy_device *phydev) 38{ 39 phydev->supported = SUPPORTED_10000baseT_Full; 40 phydev->advertising = SUPPORTED_10000baseT_Full; 41 42 return 0; 43} 44 45static int teranetics_soft_reset(struct phy_device *phydev) 46{ 47 return 0; 48} 49 | |
50static int teranetics_aneg_done(struct phy_device *phydev) 51{ | 37static int teranetics_aneg_done(struct phy_device *phydev) 38{ |
52 int reg; 53 | |
54 /* auto negotiation state can only be checked when using copper 55 * port, if using fiber port, just lie it's done. 56 */ | 39 /* auto negotiation state can only be checked when using copper 40 * port, if using fiber port, just lie it's done. 41 */ |
57 if (!phy_read_mmd(phydev, MDIO_MMD_VEND1, 93)) { 58 reg = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_STAT1); 59 return (reg < 0) ? reg : (reg & BMSR_ANEGCOMPLETE); 60 } | 42 if (!phy_read_mmd(phydev, MDIO_MMD_VEND1, 93)) 43 return genphy_c45_aneg_done(phydev); |
61 62 return 1; 63} 64 | 44 45 return 1; 46} 47 |
65static int teranetics_config_aneg(struct phy_device *phydev) 66{ 67 return 0; 68} 69 | |
70static int teranetics_read_status(struct phy_device *phydev) 71{ 72 int reg; 73 74 phydev->link = 1; 75 76 phydev->speed = SPEED_10000; 77 phydev->duplex = DUPLEX_FULL; --- 19 unchanged lines hidden (view full) --- 97 return phydev->c45_ids.device_ids[3] == PHY_ID_TN2020; 98} 99 100static struct phy_driver teranetics_driver[] = { 101{ 102 .phy_id = PHY_ID_TN2020, 103 .phy_id_mask = 0xffffffff, 104 .name = "Teranetics TN2020", | 48static int teranetics_read_status(struct phy_device *phydev) 49{ 50 int reg; 51 52 phydev->link = 1; 53 54 phydev->speed = SPEED_10000; 55 phydev->duplex = DUPLEX_FULL; --- 19 unchanged lines hidden (view full) --- 75 return phydev->c45_ids.device_ids[3] == PHY_ID_TN2020; 76} 77 78static struct phy_driver teranetics_driver[] = { 79{ 80 .phy_id = PHY_ID_TN2020, 81 .phy_id_mask = 0xffffffff, 82 .name = "Teranetics TN2020", |
105 .soft_reset = teranetics_soft_reset, | 83 .soft_reset = gen10g_no_soft_reset, |
106 .aneg_done = teranetics_aneg_done, | 84 .aneg_done = teranetics_aneg_done, |
107 .config_init = teranetics_config_init, 108 .config_aneg = teranetics_config_aneg, | 85 .config_init = gen10g_config_init, 86 .config_aneg = gen10g_config_aneg, |
109 .read_status = teranetics_read_status, 110 .match_phy_device = teranetics_match_phy_device, 111}, 112}; 113 114module_phy_driver(teranetics_driver); 115 116static struct mdio_device_id __maybe_unused teranetics_tbl[] = { 117 { PHY_ID_TN2020, 0xffffffff }, 118 { } 119}; 120 121MODULE_DEVICE_TABLE(mdio, teranetics_tbl); | 87 .read_status = teranetics_read_status, 88 .match_phy_device = teranetics_match_phy_device, 89}, 90}; 91 92module_phy_driver(teranetics_driver); 93 94static struct mdio_device_id __maybe_unused teranetics_tbl[] = { 95 { PHY_ID_TN2020, 0xffffffff }, 96 { } 97}; 98 99MODULE_DEVICE_TABLE(mdio, teranetics_tbl); |