pinmux: Make default init priority be between GPIO's prio and device prio.

Pinmux driver almost certainly should be initialized before the
rest of hardware devices (which may need specific pins already
configured for them), and usually after generic GPIO drivers.
Thus, its priority should be between KERNEL_INIT_PRIORITY_DEFAULT
(default 40) and KERNEL_INIT_PRIORITY_DEVICE (default 50). Thus,
we set PINMUX_INIT_PRIORITY to 45.

There are exceptions to the rule above for particular boards. For
example, BOARD=galileo has GPIO and pinmuxer on I2C bus and thus
overrides PINMUX_INIT_PRIORITY to be much higher. Note that while
PINMUX_INIT_PRIORITY was defined previously (at 60), it was used
only for galileo, which overrides it anyway.

This fix was prompted by investigation why eth_ksdk driver was
non-functional after kernel priorities re-hashing: both eth_ksdk
and pinmux used the same priority, and eth_ksdk happened to run
before pinmux. While bumping eth_ksdk priority would help in the
particular case, the same would likely reoccur with other drivers
like I2C, SPI, etc.

Change-Id: Ie5ca3135c1ee2fe8d9cf48d5c12e62eac63487f7
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This commit is contained in:
Paul Sokolovsky 2016-11-11 18:13:59 +03:00 committed by Anas Nashif
commit 6b2a1af1cd
4 changed files with 12 additions and 7 deletions

View file

@ -37,12 +37,17 @@ config PINMUX_NAME
config PINMUX_INIT_PRIORITY
int
prompt "Init priority"
default 60
default 45
depends on PINMUX
help
Device driver initialization priority.
The device needs to be initialized after all the devices it
uses.
Pinmux driver initialization priority.
Pinmux driver almost certainly should be initialized before the
rest of hardware devices (which may need specific pins already
configured for them), and usually after generic GPIO drivers.
Thus, its priority should be between KERNEL_INIT_PRIORITY_DEFAULT
and KERNEL_INIT_PRIORITY_DEVICE. There are exceptions to this
rule for particular boards. Don't change this value unless you
know what you are doing.
config PINMUX_K64
bool "Freescale K64-based Pin multiplexer driver"

View file

@ -53,5 +53,5 @@ int pinmux_fsl_k64_initialize(struct device *port)
/* must be initialized after GPIO */
DEVICE_AND_API_INIT(pmux, CONFIG_PINMUX_DEV_NAME, &pinmux_fsl_k64_initialize,
NULL, NULL,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
POST_KERNEL, CONFIG_PINMUX_INIT_PRIORITY,
&api_funcs);

View file

@ -114,4 +114,4 @@ static int fsl_frdm_k64f_pin_init(struct device *arg)
return 0;
}
SYS_INIT(fsl_frdm_k64f_pin_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
SYS_INIT(fsl_frdm_k64f_pin_init, POST_KERNEL, CONFIG_PINMUX_INIT_PRIORITY);

View file

@ -66,4 +66,4 @@ static int hexiwear_pin_init(struct device *arg)
return 0;
}
SYS_INIT(hexiwear_pin_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
SYS_INIT(hexiwear_pin_init, POST_KERNEL, CONFIG_PINMUX_INIT_PRIORITY);