/* MAC Hash Register Bottom */ #define LAN865X_REG_MAC_L_HASH 0x00010020 /* MAC Hash Register Top */ #define LAN865X_REG_MAC_H_HASH 0x00010021 /* MAC Specific Addr 1 Bottom Reg */ #define LAN865X_REG_MAC_L_SADDR1 0x00010022 /* MAC Specific Addr 1 Top Reg */ #define LAN865X_REG_MAC_H_SADDR1 0x00010023
staticint lan865x_set_hw_macaddr(struct lan865x_priv *priv, const u8 *mac)
{ int restore_ret;
u32 regval; int ret;
/* Configure MAC address low bytes */
ret = lan865x_set_hw_macaddr_low_bytes(priv->tc6, mac); if (ret) return ret;
/* Prepare and configure MAC address high bytes */
regval = (mac[5] << 8) | mac[4];
ret = oa_tc6_write_register(priv->tc6, LAN865X_REG_MAC_H_SADDR1,
regval); if (!ret) return0;
/* Restore the old MAC address low bytes from netdev if the new MAC *addresshighbytessettingfailed.
*/
restore_ret = lan865x_set_hw_macaddr_low_bytes(priv->tc6,
priv->netdev->dev_addr); if (restore_ret) return restore_ret;
netif_stop_queue(netdev);
phy_stop(netdev->phydev);
ret = lan865x_hw_disable(priv); if (ret) {
netdev_err(netdev, "Failed to disable the hardware: %d\n", ret); return ret;
}
priv->tc6 = oa_tc6_init(spi, netdev); if (!priv->tc6) {
ret = -ENODEV; goto free_netdev;
}
/* LAN865x Rev.B0/B1 configuration parameters from AN1760 *AspertheConfigurationApplicationNoteAN1760publishedinthe *link,https://www.microchip.com/en-us/application-notes/an1760 *RevisionF(DS60001760G-June2024),configuretheMACtosettime *stampingattheendoftheStartofFrameDelimiter(SFD)andsetthe *TimerIncrementregto40nstobeusedasa25MHzinternalclock.
*/
ret = oa_tc6_write_register(priv->tc6, LAN865X_REG_MAC_TSU_TIMER_INCR,
MAC_TSU_TIMER_INCR_COUNT_NANOSECONDS); if (ret) {
dev_err(&spi->dev, "Failed to config TSU Timer Incr reg: %d\n",
ret); goto oa_tc6_exit;
}
/* As per the point s3 in the below errata, SPI receive Ethernet frame *transfermayhaltwhenstartingthenextframeinthesamedatablock *(chunk)astheendofapreviousframe.TheRFAfieldshouldbe *configuredto01bor10bforproperoperation.Inthesemodes,only *onereceiveEthernetframewillbeplacedinasingledatablock. *WhentheRFAfieldiswrittento01b,receivedframeswillbeforced *toonlystartinthefirstwordofthedatablockpayload(SWO=0).As *recommended,enablezeroalignreceiveframefeatureforproper *operation. * *https://ww1.microchip.com/downloads/aemDocuments/documents/AIS/ProductDocuments/Errata/LAN8650-1-Errata-80001075.pdf
*/
ret = oa_tc6_zero_align_receive_frame_enable(priv->tc6); if (ret) {
dev_err(&spi->dev, "Failed to set ZARFE: %d\n", ret); goto oa_tc6_exit;
}
/* Get the MAC address from the SPI device tree node */ if (device_get_ethdev_address(&spi->dev, netdev))
eth_hw_addr_random(netdev);
ret = lan865x_set_hw_macaddr(priv, netdev->dev_addr); if (ret) {
dev_err(&spi->dev, "Failed to configure MAC: %d\n", ret); goto oa_tc6_exit;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.