From: Matt Porter Date: Tue, 21 Oct 2014 05:52:27 +0000 (-0400) Subject: greybus: ap: add support for the AP Device ID unipro management function message X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1982 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=98f4ab2df9b51356b48210188b4fbff41789acbb;p=karo-tx-linux.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/ap.c b/drivers/staging/greybus/ap.c index f4470b5b2972..5b6335643bc0 100644 --- a/drivers/staging/greybus/ap.c +++ b/drivers/staging/greybus/ap.c @@ -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, diff --git a/drivers/staging/greybus/greybus.h b/drivers/staging/greybus/greybus.h index bbd90b4cec91..a4e1f4b2b18e 100644 --- a/drivers/staging/greybus/greybus.h +++ b/drivers/staging/greybus/greybus.h @@ -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)); diff --git a/drivers/staging/greybus/svc_msg.h b/drivers/staging/greybus/svc_msg.h index 57d0a91ff60b..4aa7e177f076 100644 --- a/drivers/staging/greybus/svc_msg.h +++ b/drivers/staging/greybus/svc_msg.h @@ -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; }; };