Commit 98f4ab2d authored by Matt Porter's avatar Matt Porter Committed by Greg Kroah-Hartman

greybus: ap: add support for the AP Device ID unipro management function message

The AP needs to know its assigned Device ID in order to establish
Greybus connections between CPorts. We could have pulled the Device
ID from the controller hardware in a driver specific manner, but
instead we define one generic message from the SVC to let the
AP know this information. Add this additional unipro management
message and handle it by setting the supplied Device ID in the
struct greybus_host_device. The greybus core will use this to
populate the source Device ID when establishing a connection
between the AP and another module's CPort.
Signed-off-by: default avatarMatt Porter <mporter@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 697e55d3
...@@ -113,8 +113,13 @@ static void svc_management(struct svc_function_unipro_management *management, ...@@ -113,8 +113,13 @@ static void svc_management(struct svc_function_unipro_management *management,
return; return;
} }
/* What? An AP should not get this message */ switch (management->management_packet_type) {
dev_err(hd->parent, "Got an svc management message???\n"); case SVC_MANAGEMENT_AP_DEVICE_ID:
hd->device_id = management->ap_device_id.device_id;
break;
default:
dev_err(hd->parent, "Unhandled UniPro management message\n");
}
} }
static void svc_hotplug(struct svc_function_hotplug *hotplug, static void svc_hotplug(struct svc_function_hotplug *hotplug,
......
...@@ -180,6 +180,7 @@ struct greybus_host_device { ...@@ -180,6 +180,7 @@ struct greybus_host_device {
struct rb_root connections; struct rb_root connections;
struct ida cport_id_map; struct ida cport_id_map;
spinlock_t cport_id_map_lock; spinlock_t cport_id_map_lock;
u8 device_id;
/* Private data for the host driver */ /* Private data for the host driver */
unsigned long hd_priv[0] __aligned(sizeof(s64)); unsigned long hd_priv[0] __aligned(sizeof(s64));
......
...@@ -58,9 +58,14 @@ struct svc_function_unipro_link_up { ...@@ -58,9 +58,14 @@ struct svc_function_unipro_link_up {
__u8 device_id; __u8 device_id;
}; };
struct svc_function_ap_device_id {
__u8 device_id;
};
enum svc_function_management_event { enum svc_function_management_event {
SVC_MANAGEMENT_SET_ROUTE = 0x00, SVC_MANAGEMENT_SET_ROUTE = 0x00,
SVC_MANAGEMENT_LINK_UP = 0x01, SVC_MANAGEMENT_LINK_UP = 0x01,
SVC_MANAGEMENT_AP_DEVICE_ID = 0x02,
}; };
struct svc_function_unipro_management { struct svc_function_unipro_management {
...@@ -68,6 +73,7 @@ struct svc_function_unipro_management { ...@@ -68,6 +73,7 @@ struct svc_function_unipro_management {
union { union {
struct svc_function_unipro_set_route set_route; struct svc_function_unipro_set_route set_route;
struct svc_function_unipro_link_up link_up; struct svc_function_unipro_link_up link_up;
struct svc_function_ap_device_id ap_device_id;
}; };
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment