ethernet: Add driver initialization priority to Kconfig

The default kernel init priority is too low. Make this
configurable and set the default priority so that the
ethernet driver is started just before the network stack.

This commit adds generic ethernet priority and changes
currently available ethernet drivers to use it.

Change-Id: If695e52b6dd9ea227f10ba306bb145d72d2312b0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2016-11-19 00:22:05 +02:00
commit f2b7492269
7 changed files with 15 additions and 14 deletions

View file

@ -31,6 +31,16 @@ config SYS_LOG_ETHERNET_LEVEL
3 INFO, write SYS_LOG_INF in adition to previous levels
4 DEBUG, write SYS_LOG_DBG in adition to previous levels
config ETH_INIT_PRIORITY
int
prompt "Ethernet driver init priority"
default 80
help
Ethernet device driver initialization priority.
Do not mess with it unless you know what you are doing.
Note that the priority needs to be lower than the net stack
so that it can start before the networking sub-system.
menuconfig ETH_DW
bool
prompt "Synopsys DesignWare Ethernet driver"

View file

@ -44,15 +44,6 @@ config ETH_EN28J60_0_FULL_DUPLEX
Enable Full Duplex. Device is configured half duplex
when disabled.
config ETH_ENC28J60_0_INIT_PRIORITY
int
prompt "ENC28J60C init priority"
default 80
help
Device driver initialization priority.
Since the device is connected to SPI bus, its driver has
to be initialized after the SPI one.
config ETH_ENC28J60_0_GPIO_PORT_NAME
string "GPIO controller port name"
default "GPIO_0"

View file

@ -314,7 +314,7 @@ static struct eth_runtime eth_0_runtime = {
DEVICE_INIT(eth_dw_0, CONFIG_ETH_DW_0_NAME, eth_initialize,
&eth_0_runtime, &eth_config_0,
NANOKERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
NANOKERNEL, CONFIG_ETH_INIT_PRIORITY);
static int eth_net_tx(struct net_buf *buf)
{

View file

@ -689,7 +689,7 @@ static const struct eth_enc28j60_config eth_enc28j60_0_config = {
NET_DEVICE_INIT(enc28j60_0, CONFIG_ETH_ENC28J60_0_NAME,
eth_enc28j60_init, &eth_enc28j60_0_runtime,
&eth_enc28j60_0_config,
CONFIG_ETH_ENC28J60_0_INIT_PRIORITY,
CONFIG_ETH_INIT_PRIORITY,
&api_funcs_0, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 1500);
#endif /* CONFIG_ETH_ENC28J60_0 */

View file

@ -633,7 +633,7 @@ static const struct eth_enc28j60_config eth_enc28j60_0_config = {
DEVICE_AND_API_INIT(eth_enc28j60_0, CONFIG_ETH_ENC28J60_0_NAME,
&eth_enc28j60_init, &eth_enc28j60_0_runtime,
&eth_enc28j60_0_config, POST_KERNEL,
CONFIG_ETH_ENC28J60_0_INIT_PRIORITY, &api_funcs);
CONFIG_ETH_INIT_PRIORITY, &api_funcs);
static int eth_net_tx(struct net_buf *buf)
{

View file

@ -411,7 +411,7 @@ static struct eth_context eth_0_context = {
NET_DEVICE_INIT(eth_ksdk_0, CONFIG_ETH_KSDK_0_NAME,
eth_0_init, &eth_0_context,
NULL,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
CONFIG_ETH_INIT_PRIORITY,
&api_funcs_0, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 1500);
static void eth_0_config_func(void)

View file

@ -312,7 +312,7 @@ static struct eth_context eth_0_context = {
DEVICE_INIT(eth_ksdk_0, CONFIG_ETH_KSDK_0_NAME, eth_0_init,
&eth_0_context, NULL,
NANOKERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
NANOKERNEL, CONFIG_ETH_INIT_PRIORITY);
static int eth_net_tx(struct net_buf *buf)
{