From 83a0cb593b5517a13f88c8f9ae9ce7e43af4b54b Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Wed, 1 Apr 2015 20:31:59 +0530 Subject: [PATCH] greybus: Add bundle descriptor type A bundle corresponds to a device and a greybus driver binds to it. This patch adds a type and descriptor for bundle. This also shuffles the values of 'enum greybus_descriptor_type' to align them with Greybus Specifications. Signed-off-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/greybus_manifest.h | 30 ++++++++++++++++++++++++++++-- drivers/staging/greybus/manifest.c | 2 ++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/staging/greybus/greybus_manifest.h b/drivers/staging/greybus/greybus_manifest.h index 9ab1c82..96702f4 100644 --- a/drivers/staging/greybus/greybus_manifest.h +++ b/drivers/staging/greybus/greybus_manifest.h @@ -17,11 +17,12 @@ enum greybus_descriptor_type { GREYBUS_TYPE_INVALID = 0x00, - GREYBUS_TYPE_MODULE = 0x01, + GREYBUS_TYPE_INTERFACE = 0x01, GREYBUS_TYPE_STRING = 0x02, - GREYBUS_TYPE_INTERFACE = 0x03, + GREYBUS_TYPE_BUNDLE = 0x03, GREYBUS_TYPE_CPORT = 0x04, GREYBUS_TYPE_CLASS = 0x05, + GREYBUS_TYPE_MODULE = 0x06, }; enum greybus_protocol { @@ -109,6 +110,30 @@ struct greybus_descriptor_interface { }; /* + * An bundle descriptor defines an identification number and a class type for + * each bundle. + * + * @id: Uniquely identifies a bundle within a interface, its sole purpose is to + * allow CPort descriptors to specify which bundle they are associated with. + * The first bundle will have id 0, second will have 1 and so on. + * + * The largest CPort id associated with an bundle (defined by a + * CPort descriptor in the manifest) is used to determine how to + * encode the device id and module number in UniPro packets + * that use the bundle. + * + * @class_type: It is used by kernel to know the functionality provided by the + * bundle and will be matched against drivers functinality while probing greybus + * driver. It should contain one of the values defined in + * 'enum greybus_class_type'. + * + */ +struct greybus_descriptor_bundle { + __u8 id; /* interface-relative id (0..) */ + __u8 class_type; +}; + +/* * A CPort descriptor indicates the id of the bundle within the * module it's associated with, along with the CPort id used to * address the CPort. The protocol id defines the format of messages @@ -139,6 +164,7 @@ struct greybus_descriptor { struct greybus_descriptor_module module; struct greybus_descriptor_string string; struct greybus_descriptor_interface interface; + struct greybus_descriptor_bundle bundle; struct greybus_descriptor_cport cport; struct greybus_descriptor_class class; }; diff --git a/drivers/staging/greybus/manifest.c b/drivers/staging/greybus/manifest.c index c29a0c8..c00e378 100644 --- a/drivers/staging/greybus/manifest.c +++ b/drivers/staging/greybus/manifest.c @@ -26,6 +26,8 @@ static const char *get_descriptor_type_string(u8 type) return "interface"; case GREYBUS_TYPE_CPORT: return "cport"; + case GREYBUS_TYPE_BUNDLE: + return "bundle"; case GREYBUS_TYPE_CLASS: return "class"; default: -- 2.7.4