drivers: eth_mcux: update for dts change to local-mac-address
uint8_array values are now generated as structure initializers. Update the code accordingly. The implementation assumes that existing devicetree source does not provide the correct OUI so preserves the in-driver override of the value provided by devicetree and its setting for random/unique addresses. Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
parent
388460ac14
commit
ec2ba8d968
3 changed files with 13 additions and 15 deletions
|
@ -35,6 +35,10 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
|
||||||
#include "fsl_enet.h"
|
#include "fsl_enet.h"
|
||||||
#include "fsl_phy.h"
|
#include "fsl_phy.h"
|
||||||
|
|
||||||
|
#define FREESCALE_OUI_B0 0x00
|
||||||
|
#define FREESCALE_OUI_B1 0x04
|
||||||
|
#define FREESCALE_OUI_B2 0x9f
|
||||||
|
|
||||||
enum eth_mcux_phy_state {
|
enum eth_mcux_phy_state {
|
||||||
eth_mcux_phy_state_initial,
|
eth_mcux_phy_state_initial,
|
||||||
eth_mcux_phy_state_reset,
|
eth_mcux_phy_state_reset,
|
||||||
|
@ -817,6 +821,12 @@ static int eth_0_init(struct device *dev)
|
||||||
enet_config.macSpecialConfig |= kENET_ControlPromiscuousEnable;
|
enet_config.macSpecialConfig |= kENET_ControlPromiscuousEnable;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Initialize/override OUI which may not be correct in
|
||||||
|
* devicetree.
|
||||||
|
*/
|
||||||
|
context->mac_addr[0] = FREESCALE_OUI_B0;
|
||||||
|
context->mac_addr[1] = FREESCALE_OUI_B1;
|
||||||
|
context->mac_addr[2] = FREESCALE_OUI_B2;
|
||||||
#if defined(CONFIG_ETH_MCUX_0_UNIQUE_MAC) || \
|
#if defined(CONFIG_ETH_MCUX_0_UNIQUE_MAC) || \
|
||||||
defined(CONFIG_ETH_MCUX_0_RANDOM_MAC)
|
defined(CONFIG_ETH_MCUX_0_RANDOM_MAC)
|
||||||
generate_mac(context->mac_addr);
|
generate_mac(context->mac_addr);
|
||||||
|
@ -1004,17 +1014,9 @@ static void eth_mcux_error_isr(void *p)
|
||||||
static struct eth_context eth_0_context = {
|
static struct eth_context eth_0_context = {
|
||||||
.phy_duplex = kPHY_FullDuplex,
|
.phy_duplex = kPHY_FullDuplex,
|
||||||
.phy_speed = kPHY_Speed100M,
|
.phy_speed = kPHY_Speed100M,
|
||||||
.mac_addr = {
|
|
||||||
/* Freescale's OUI */
|
|
||||||
0x00,
|
|
||||||
0x04,
|
|
||||||
0x9f,
|
|
||||||
#if defined(CONFIG_ETH_MCUX_0_MANUAL_MAC)
|
#if defined(CONFIG_ETH_MCUX_0_MANUAL_MAC)
|
||||||
DT_ETH_MCUX_0_MAC3,
|
.mac_addr = DT_ETH_MCUX_0_MAC,
|
||||||
DT_ETH_MCUX_0_MAC4,
|
|
||||||
DT_ETH_MCUX_0_MAC5
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ETH_NET_DEVICE_INIT(eth_mcux_0, DT_ETH_MCUX_0_NAME, eth_0_init,
|
ETH_NET_DEVICE_INIT(eth_mcux_0, DT_ETH_MCUX_0_NAME, eth_0_init,
|
||||||
|
|
|
@ -118,9 +118,7 @@
|
||||||
|
|
||||||
#define DT_ETH_MCUX_0_NAME DT_NXP_KINETIS_ETHERNET_402D8000_LABEL
|
#define DT_ETH_MCUX_0_NAME DT_NXP_KINETIS_ETHERNET_402D8000_LABEL
|
||||||
|
|
||||||
#define DT_ETH_MCUX_0_MAC3 DT_NXP_KINETIS_ETHERNET_402D8000_LOCAL_MAC_ADDRESS_3
|
#define DT_ETH_MCUX_0_MAC DT_NXP_KINETIS_ETHERNET_402D8000_LOCAL_MAC_ADDRESS
|
||||||
#define DT_ETH_MCUX_0_MAC4 DT_NXP_KINETIS_ETHERNET_402D8000_LOCAL_MAC_ADDRESS_4
|
|
||||||
#define DT_ETH_MCUX_0_MAC5 DT_NXP_KINETIS_ETHERNET_402D8000_LOCAL_MAC_ADDRESS_5
|
|
||||||
|
|
||||||
#define DT_IRQ_ETH_COMMON DT_NXP_KINETIS_ETHERNET_402D8000_IRQ_0
|
#define DT_IRQ_ETH_COMMON DT_NXP_KINETIS_ETHERNET_402D8000_IRQ_0
|
||||||
#define DT_IRQ_ETH_IEEE1588_TMR DT_NXP_KINETIS_PTP_402D8000_PTP_IRQ_0
|
#define DT_IRQ_ETH_IEEE1588_TMR DT_NXP_KINETIS_PTP_402D8000_PTP_IRQ_0
|
||||||
|
|
|
@ -132,9 +132,7 @@
|
||||||
|
|
||||||
#define DT_ETH_MCUX_0_NAME DT_NXP_KINETIS_ETHERNET_400C0004_LABEL
|
#define DT_ETH_MCUX_0_NAME DT_NXP_KINETIS_ETHERNET_400C0004_LABEL
|
||||||
|
|
||||||
#define DT_ETH_MCUX_0_MAC3 DT_NXP_KINETIS_ETHERNET_400C0004_LOCAL_MAC_ADDRESS_3
|
#define DT_ETH_MCUX_0_MAC DT_NXP_KINETIS_ETHERNET_400C0004_LOCAL_MAC_ADDRESS
|
||||||
#define DT_ETH_MCUX_0_MAC4 DT_NXP_KINETIS_ETHERNET_400C0004_LOCAL_MAC_ADDRESS_4
|
|
||||||
#define DT_ETH_MCUX_0_MAC5 DT_NXP_KINETIS_ETHERNET_400C0004_LOCAL_MAC_ADDRESS_5
|
|
||||||
|
|
||||||
/* IRQs */
|
/* IRQs */
|
||||||
#define DT_IRQ_ETH_IEEE1588_TMR DT_NXP_KINETIS_PTP_400C0004_PTP_IRQ_IEEE1588_TMR
|
#define DT_IRQ_ETH_IEEE1588_TMR DT_NXP_KINETIS_PTP_400C0004_PTP_IRQ_IEEE1588_TMR
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue