drivers: eth_mcux: kinetis networking device Tree

Partially replaces Kinetis MCUX driver configuration from Kconfig to
Device Tree. Interrputs moved from defines configuration to DT.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
This commit is contained in:
Andrei Gansari 2018-09-27 15:23:06 +03:00 committed by Kumar Gala
commit 02e217df50
9 changed files with 121 additions and 52 deletions

View file

@ -33,6 +33,7 @@
led2 = &red_led;
sw0 = &user_button_3;
sw1 = &user_button_2;
eth = &eth;
};
chosen {
@ -194,3 +195,10 @@
};
};
};
&eth {
status = "ok";
ptp {
status = "ok";
};
};

View file

@ -53,18 +53,6 @@ config ETH_MCUX_0
help
Include port 0 driver
config ETH_MCUX_0_NAME
string "Driver name"
depends on ETH_MCUX_0
default "ETH_0"
config ETH_MCUX_0_IRQ_PRI
int "Controller interrupt priority"
depends on ETH_MCUX_0
default 0
help
IRQ priority
choice ETH_MCUX_0_MAC_SELECT
prompt "MAC address"
help
@ -89,30 +77,6 @@ config ETH_MCUX_0_MANUAL_MAC
endchoice
if ETH_MCUX_0_MANUAL_MAC
config ETH_MCUX_0_MAC3
hex "MAC Address Byte 3"
default 0
range 0 0xff
help
This is the byte 3 of the MAC address.
config ETH_MCUX_0_MAC4
hex "MAC Address Byte 4"
default 0
range 0 0xff
help
This is the byte 4 of the MAC address.
config ETH_MCUX_0_MAC5
hex "MAC Address Byte 5"
default 0
range 0 0xff
help
This is the byte 5 of the MAC address.
endif
config PTP_CLOCK_MCUX
bool "MCUX PTP clock driver support"
default y
@ -145,4 +109,4 @@ config ETH_MCUX_PTP_CLOCK_SRC_HZ
endif # PTP_CLOCK_MCUX
endif
endif # ETH_MCUX

View file

@ -982,22 +982,22 @@ ETH_NET_DEVICE_INIT(eth_mcux_0, CONFIG_ETH_MCUX_0_NAME, eth_0_init,
static void eth_0_config_func(void)
{
IRQ_CONNECT(IRQ_ETH_RX, CONFIG_ETH_MCUX_0_IRQ_PRI,
IRQ_CONNECT(CONFIG_IRQ_ETH_RX, CONFIG_ETH_MCUX_0_IRQ_PRI,
eth_mcux_rx_isr, DEVICE_GET(eth_mcux_0), 0);
irq_enable(IRQ_ETH_RX);
irq_enable(CONFIG_IRQ_ETH_RX);
IRQ_CONNECT(IRQ_ETH_TX, CONFIG_ETH_MCUX_0_IRQ_PRI,
IRQ_CONNECT(CONFIG_IRQ_ETH_TX, CONFIG_ETH_MCUX_0_IRQ_PRI,
eth_mcux_tx_isr, DEVICE_GET(eth_mcux_0), 0);
irq_enable(IRQ_ETH_TX);
irq_enable(CONFIG_IRQ_ETH_TX);
IRQ_CONNECT(IRQ_ETH_ERR_MISC, CONFIG_ETH_MCUX_0_IRQ_PRI,
IRQ_CONNECT(CONFIG_IRQ_ETH_ERR_MISC, CONFIG_ETH_MCUX_0_IRQ_PRI,
eth_mcux_error_isr, DEVICE_GET(eth_mcux_0), 0);
irq_enable(IRQ_ETH_ERR_MISC);
irq_enable(CONFIG_IRQ_ETH_ERR_MISC);
#if defined(CONFIG_PTP_CLOCK_MCUX)
IRQ_CONNECT(IRQ_ETH_IEEE1588_TMR, CONFIG_ETH_MCUX_0_IRQ_PRI,
IRQ_CONNECT(CONFIG_IRQ_ETH_IEEE1588_TMR, CONFIG_ETH_MCUX_0_IRQ_PRI,
eth_mcux_ptp_isr, DEVICE_GET(eth_mcux_0), 0);
irq_enable(IRQ_ETH_IEEE1588_TMR);
irq_enable(CONFIG_IRQ_ETH_IEEE1588_TMR);
#endif
}

View file

@ -393,6 +393,22 @@
status = "disabled";
label = "USBD";
};
eth: ethernet@400C0004 {
compatible = "nxp,kinetis-ethernet";
reg = <0x400C0004 0x620>;
interrupts = <83 0>, <84 0>, <85 0>;
interrupts-names = "TX", "RX", "ERR_MISC";
status = "disabled";
local-mac-address = [00 00 00 00 00 00];
label = "ETH_0";
ptp {
compatible = "nxp,kinetis-ptp";
status = "disabled";
interrupts = <82 0>;
interrupts-names = "IEEE1588_TMR";
};
};
};
};

View file

@ -0,0 +1,23 @@
#
# Copyright (c) 2018, Linaro Limited
#
# SPDX-License-Identifier: Apache-2.0
#
---
title: Ethernet Base Structure
version: 0.1
description: >
This binding gives a base structures for all Ethernet devices
properties:
local-mac-address:
type: array
category: optional
description: mac address
generation: define
label:
type: string
category: required
description: Human readable string describing the device (used by Zephyr for API name)
generation: define
...

View file

@ -0,0 +1,31 @@
#
# Copyright (c) 2018, Linaro Limited
#
# SPDX-License-Identifier: Apache-2.0
#
---
title: NXP Kinetis Ethernet
version: 0.1
description: >
This binding gives a base representation of the NXP Kinetis Ethernet
inherits:
!include ethernet.yaml
properties:
compatible:
type: string
category: required
description: compatible strings
constraint: "nxp,kinetis-ethernet"
reg:
type: array
description: mmio register space
generation: define
category: required
interrupts:
type: array
category: required
description: required interrupts
generation: define
...

View file

@ -0,0 +1,21 @@
#
# Copyright (c) 2018, Linaro Limited
#
# SPDX-License-Identifier: Apache-2.0
#
---
title: NXP Kinetis Ethernet PTP
version: 0.1
description: >
This binding gives a base representation of the NXP Kinetis Ethernet PTP
inherits:
!include ethernet.yaml
properties:
compatible:
type: string
category: required
description: compatible strings
constraint: "nxp,kinetis-ptp"
...

View file

@ -122,4 +122,17 @@
#define CONFIG_USBD_KINETIS_BASE_ADDRESS NXP_KINETIS_USBD_40072000_BASE_ADDRESS
#define CONFIG_USBD_KINETIS_NUM_BIDIR_EP NXP_KINETIS_USBD_40072000_NUM_BIDIR_ENDPOINTS
#define CONFIG_ETH_MCUX_0_NAME ETH_LABEL
#define CONFIG_ETH_MCUX_0_MAC3 NXP_KINETIS_ETHERNET_400C0004_LOCAL_MAC_ADDRESS_3
#define CONFIG_ETH_MCUX_0_MAC4 NXP_KINETIS_ETHERNET_400C0004_LOCAL_MAC_ADDRESS_4
#define CONFIG_ETH_MCUX_0_MAC5 NXP_KINETIS_ETHERNET_400C0004_LOCAL_MAC_ADDRESS_5
/* IRQs */
#define CONFIG_IRQ_ETH_IEEE1588_TMR NXP_KINETIS_ETHERNET_400C0004_IRQ_ERR_MISC
#define CONFIG_IRQ_ETH_RX NXP_KINETIS_ETHERNET_400C0004_IRQ_RX
#define CONFIG_IRQ_ETH_TX NXP_KINETIS_ETHERNET_400C0004_IRQ_TX
#define CONFIG_IRQ_ETH_ERR_MISC NXP_KINETIS_ETHERNET_400C0004_IRQ_ERR_MISC
#define CONFIG_ETH_MCUX_0_IRQ_PRI NXP_KINETIS_ETHERNET_400C0004_IRQ_RX_PRIORITY
/* End of SoC Level DTS fixup file */

View file

@ -31,13 +31,6 @@ extern "C" {
#define PERIPH_ADDR_BASE_WDOG 0x40052000 /* Watchdog Timer module */
/* IRQs */
#define IRQ_ETH_IEEE1588_TMR 82
#define IRQ_ETH_TX 83
#define IRQ_ETH_RX 84
#define IRQ_ETH_ERR_MISC 85
#ifndef _ASMLANGUAGE
#include <fsl_common.h>