Lines Matching +full:- +full:p
4 * SPDX-License-Identifier: Apache-2.0
8 * downloads/en/DeviceDoc/KSZ9021RL-RN-Data-Sheet-DS00003050A.pdf)
51 #define PHY_AUTOCAP BIT(3) /* Auto-negotiation capability */
55 /* Auto-Negotiation Advertisement */
64 /* 1000Base-T Control */
83 uint16_t phy_value, struct eth_cyclonev_priv *p);
85 uint16_t *rdval, struct eth_cyclonev_priv *p);
87 uint16_t phy_value, struct eth_cyclonev_priv *p);
89 uint16_t *rdval, struct eth_cyclonev_priv *p);
90 int alt_eth_phy_config(uint16_t instance, struct eth_cyclonev_priv *p);
91 int alt_eth_phy_reset(uint16_t instance, struct eth_cyclonev_priv *p);
93 uint16_t instance, struct eth_cyclonev_priv *p);
96 uint16_t phy_value, struct eth_cyclonev_priv *p) in alt_eth_phy_write_register() argument
103 return -1; in alt_eth_phy_write_register()
122 sys_write32(phy_value & 0xffff, EMAC_GMAC_GMII_DATA_ADDR(p->base_addr)); in alt_eth_phy_write_register()
124 sys_write32(tmpreg & 0xffff, EMAC_GMAC_GMII_ADDR_ADDR(p->base_addr)); in alt_eth_phy_write_register()
130 tmpreg = sys_read32(EMAC_GMAC_GMII_ADDR_ADDR(p->base_addr)); in alt_eth_phy_write_register()
135 return -1; in alt_eth_phy_write_register()
143 struct eth_cyclonev_priv *p) in alt_eth_phy_read_register() argument
150 return -1; in alt_eth_phy_read_register()
169 sys_write32(tmpreg & 0xffff, EMAC_GMAC_GMII_ADDR_ADDR(p->base_addr)); in alt_eth_phy_read_register()
174 tmpreg = sys_read32(EMAC_GMAC_GMII_ADDR_ADDR(p->base_addr)); in alt_eth_phy_read_register()
179 return -1; in alt_eth_phy_read_register()
183 *rdval = sys_read32(EMAC_GMAC_GMII_DATA_ADDR(p->base_addr)); in alt_eth_phy_read_register()
189 uint16_t phy_value, struct eth_cyclonev_priv *p) in alt_eth_phy_write_register_extended() argument
194 KSZPHY_EXTREG_WRITE | phy_reg, p); in alt_eth_phy_write_register_extended()
196 if (rc == -1) { in alt_eth_phy_write_register_extended()
200 rc = alt_eth_phy_write_register(emac_instance, MII_KSZPHY_EXTREG_WRITE, phy_value, p); in alt_eth_phy_write_register_extended()
205 struct eth_cyclonev_priv *p) in alt_eth_phy_read_register_extended() argument
209 rc = alt_eth_phy_write_register(emac_instance, MII_KSZPHY_EXTREG, phy_reg, p); in alt_eth_phy_read_register_extended()
211 if (rc == -1) { in alt_eth_phy_read_register_extended()
216 rc = alt_eth_phy_read_register(emac_instance, MII_KSZPHY_EXTREG_READ, rdval, p); in alt_eth_phy_read_register_extended()
221 int alt_eth_phy_config(uint16_t instance, struct eth_cyclonev_priv *p) in alt_eth_phy_config() argument
227 /*-------------------- Configure the PHY skew values ----------------*/ in alt_eth_phy_config()
230 PHY_CLK_AND_CONTROL_PAD_SKEW_VALUE, p); in alt_eth_phy_config()
231 if (rc == -1) { in alt_eth_phy_config()
236 PHY_RX_DATA_PAD_SKEW_VALUE, p); in alt_eth_phy_config()
237 if (rc == -1) { in alt_eth_phy_config()
241 /* Implement Auto-negotiation Process */ in alt_eth_phy_config()
243 /* Check PHY Status if auto-negotiation is supported */ in alt_eth_phy_config()
244 rc = alt_eth_phy_read_register(instance, PHY_BSR, &rdval, p); in alt_eth_phy_config()
245 if (((rdval & PHY_AUTOCAP) == 0) || (rc == -1)) { in alt_eth_phy_config()
246 return -1; in alt_eth_phy_config()
249 /* Set Advertise capabilities for 10Base-T/ in alt_eth_phy_config()
250 *10Base-T full-duplex/100Base-T/100Base-T full-duplex in alt_eth_phy_config()
252 rc = alt_eth_phy_read_register(instance, PHY_AUTON, &rdval, p); in alt_eth_phy_config()
253 if (rc == -1) { in alt_eth_phy_config()
259 rc = alt_eth_phy_write_register(instance, PHY_AUTON, rdval, p); in alt_eth_phy_config()
260 if (rc == -1) { in alt_eth_phy_config()
264 /* Set Advertise capabilities for 1000 Base-T/1000 Base-T full-duplex */ in alt_eth_phy_config()
269 , p); in alt_eth_phy_config()
270 if (rc == -1) { in alt_eth_phy_config()
278 rc = alt_eth_phy_read_register(instance, PHY_BSR, &rdval, p); in alt_eth_phy_config()
282 if ((timeout == PHY_READ_TO) || (rc == -1)) { in alt_eth_phy_config()
284 return -1; in alt_eth_phy_config()
289 rc = alt_eth_phy_read_register(instance, PHY_BCR, &rdval, p); in alt_eth_phy_config()
290 if (rc == -1) { in alt_eth_phy_config()
296 rc = alt_eth_phy_write_register(instance, PHY_BCR, rdval, p); in alt_eth_phy_config()
297 if (rc == -1) { in alt_eth_phy_config()
301 /* Wait until the auto-negotiation is completed */ in alt_eth_phy_config()
305 rc = alt_eth_phy_read_register(instance, PHY_BSR, &rdval, p); in alt_eth_phy_config()
309 if ((timeout == PHY_READ_TO) || (rc == -1)) { in alt_eth_phy_config()
310 alt_eth_phy_read_register(instance, PHY_BSR, &rdval, p); in alt_eth_phy_config()
312 return -1; in alt_eth_phy_config()
319 int alt_eth_phy_reset(uint16_t instance, struct eth_cyclonev_priv *p) in alt_eth_phy_reset() argument
326 if ((alt_eth_phy_write_register(instance, PHY_BCR, PHY_RESET, p)) != 0) { in alt_eth_phy_reset()
328 return -1; in alt_eth_phy_reset()
334 rc = alt_eth_phy_read_register(instance, PHY_BCR, &rdval, p); in alt_eth_phy_reset()
335 if (((rdval & PHY_RESET) == 0) || (rc == -1)) { in alt_eth_phy_reset()
341 return -1; in alt_eth_phy_reset()
350 uint16_t instance, struct eth_cyclonev_priv *p) in alt_eth_phy_get_duplex_and_speed() argument
357 rc = alt_eth_phy_read_register(instance, PHY_CR, ®val, p); in alt_eth_phy_get_duplex_and_speed()