can: dts: Convert can-primary alias to zephyr,can-primary chosen prop

Convert CAN to use a chosen node property that is similar to how we
handle zephyr,entroy or zephyr,flash-controller as the means to select a
specific peripheral instance utilized by a subsystem.

Replace references of the form:

alias {
	can-primary = &can1;
};

with:

chosen {
	zephyr,can-primary = &can1;
};

Replace various macro/define references with either
DT_CHOSEN(zephyr_can_primary) or replace DT_ALIAS_CAN_PRIMARY_LABEL
with DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2020-04-28 07:33:18 -05:00 committed by Kumar Gala
commit 3f236f2183
22 changed files with 40 additions and 25 deletions

View file

@ -372,9 +372,11 @@ static struct net_can_api net_can_api_inst = {
static int net_can_init(struct device *dev)
{
struct device *can_dev = device_get_binding(DT_ALIAS_CAN_PRIMARY_LABEL);
struct device *can_dev;
struct net_can_context *ctx = dev->driver_data;
can_dev = device_get_binding(DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL);
ctx->recv_filter_id = CAN_NET_FILTER_NOT_SET;
#ifdef CONFIG_NET_L2_CANBUS_ETH_TRANSLATOR
ctx->eth_bridge_filter_id = CAN_NET_FILTER_NOT_SET;
@ -383,7 +385,7 @@ static int net_can_init(struct device *dev)
if (!can_dev) {
NET_ERR("Can't get binding to CAN device %s",
DT_ALIAS_CAN_PRIMARY_LABEL);
DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL);
return -EIO;
}