Skip to content
Permalink
Browse files

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>
  • Loading branch information...
pabigot authored and galak committed Jul 10, 2019
1 parent 388460a commit ec2ba8d9685870ca12d8dd507888c643f1c609fb
Showing with 13 additions and 15 deletions.
  1. +11 −9 drivers/ethernet/eth_mcux.c
  2. +1 −3 soc/arm/nxp_imx/rt/dts_fixup.h
  3. +1 −3 soc/arm/nxp_kinetis/k6x/dts_fixup.h
@@ -35,6 +35,10 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include "fsl_enet.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 {
eth_mcux_phy_state_initial,
eth_mcux_phy_state_reset,
@@ -817,6 +821,12 @@ static int eth_0_init(struct device *dev)
enet_config.macSpecialConfig |= kENET_ControlPromiscuousEnable;
#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) || \
defined(CONFIG_ETH_MCUX_0_RANDOM_MAC)
generate_mac(context->mac_addr);
@@ -1004,17 +1014,9 @@ static void eth_mcux_error_isr(void *p)
static struct eth_context eth_0_context = {
.phy_duplex = kPHY_FullDuplex,
.phy_speed = kPHY_Speed100M,
.mac_addr = {
/* Freescale's OUI */
0x00,
0x04,
0x9f,
#if defined(CONFIG_ETH_MCUX_0_MANUAL_MAC)
DT_ETH_MCUX_0_MAC3,
DT_ETH_MCUX_0_MAC4,
DT_ETH_MCUX_0_MAC5
.mac_addr = DT_ETH_MCUX_0_MAC,
#endif
}
};

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_MAC3 DT_NXP_KINETIS_ETHERNET_402D8000_LOCAL_MAC_ADDRESS_3
#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_ETH_MCUX_0_MAC DT_NXP_KINETIS_ETHERNET_402D8000_LOCAL_MAC_ADDRESS

#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
@@ -132,9 +132,7 @@

#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_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
#define DT_ETH_MCUX_0_MAC DT_NXP_KINETIS_ETHERNET_400C0004_LOCAL_MAC_ADDRESS

/* IRQs */
#define DT_IRQ_ETH_IEEE1588_TMR DT_NXP_KINETIS_PTP_400C0004_PTP_IRQ_IEEE1588_TMR

0 comments on commit ec2ba8d

Please sign in to comment.
You can’t perform that action at this time.