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: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
This commit is contained in:
Matt Porter 2014-10-21 01:52:27 -04:00 committed by Greg Kroah-Hartman
parent 697e55d35d
commit 98f4ab2df9
3 changed files with 14 additions and 2 deletions

View File

@ -113,8 +113,13 @@ static void svc_management(struct svc_function_unipro_management *management,
return;
}
/* What? An AP should not get this message */
dev_err(hd->parent, "Got an svc management message???\n");
switch (management->management_packet_type) {
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,

View File

@ -180,6 +180,7 @@ struct greybus_host_device {
struct rb_root connections;
struct ida cport_id_map;
spinlock_t cport_id_map_lock;
u8 device_id;
/* Private data for the host driver */
unsigned long hd_priv[0] __aligned(sizeof(s64));

View File

@ -58,9 +58,14 @@ struct svc_function_unipro_link_up {
__u8 device_id;
};
struct svc_function_ap_device_id {
__u8 device_id;
};
enum svc_function_management_event {
SVC_MANAGEMENT_SET_ROUTE = 0x00,
SVC_MANAGEMENT_LINK_UP = 0x01,
SVC_MANAGEMENT_AP_DEVICE_ID = 0x02,
};
struct svc_function_unipro_management {
@ -68,6 +73,7 @@ struct svc_function_unipro_management {
union {
struct svc_function_unipro_set_route set_route;
struct svc_function_unipro_link_up link_up;
struct svc_function_ap_device_id ap_device_id;
};
};