]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
greybus: ap: add support for the AP Device ID unipro management function message
authorMatt Porter <mporter@linaro.org>
Tue, 21 Oct 2014 05:52:27 +0000 (01:52 -0400)
committerGreg Kroah-Hartman <greg@kroah.com>
Tue, 21 Oct 2014 06:37:21 +0000 (14:37 +0800)
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>
drivers/staging/greybus/ap.c
drivers/staging/greybus/greybus.h
drivers/staging/greybus/svc_msg.h

index f4470b5b2972c823b39c267a33189b4d9c001c79..5b6335643bc0e2eaf4bf75377cef90166114bc95 100644 (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,
index bbd90b4cec9116ced6d18271dcd2993e6bec8a34..a4e1f4b2b18e9de57ffd6954c53bd2c72e32a65a 100644 (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));
index 57d0a91ff60b1922b28c1e512a1d3da3b24b7357..4aa7e177f07667c924b3f7de8ad94f909b67925a 100644 (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;
        };
 };