Commit 83a0cb59 authored by Viresh Kumar's avatar Viresh Kumar Committed by Greg Kroah-Hartman

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: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent c9d9d0d4
...@@ -17,11 +17,12 @@ ...@@ -17,11 +17,12 @@
enum greybus_descriptor_type { enum greybus_descriptor_type {
GREYBUS_TYPE_INVALID = 0x00, GREYBUS_TYPE_INVALID = 0x00,
GREYBUS_TYPE_MODULE = 0x01, GREYBUS_TYPE_INTERFACE = 0x01,
GREYBUS_TYPE_STRING = 0x02, GREYBUS_TYPE_STRING = 0x02,
GREYBUS_TYPE_INTERFACE = 0x03, GREYBUS_TYPE_BUNDLE = 0x03,
GREYBUS_TYPE_CPORT = 0x04, GREYBUS_TYPE_CPORT = 0x04,
GREYBUS_TYPE_CLASS = 0x05, GREYBUS_TYPE_CLASS = 0x05,
GREYBUS_TYPE_MODULE = 0x06,
}; };
enum greybus_protocol { enum greybus_protocol {
...@@ -108,6 +109,30 @@ struct greybus_descriptor_interface { ...@@ -108,6 +109,30 @@ struct greybus_descriptor_interface {
__u8 id; /* module-relative id (0..) */ __u8 id; /* module-relative id (0..) */
}; };
/*
* 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 * A CPort descriptor indicates the id of the bundle within the
* module it's associated with, along with the CPort id used to * module it's associated with, along with the CPort id used to
...@@ -139,6 +164,7 @@ struct greybus_descriptor { ...@@ -139,6 +164,7 @@ struct greybus_descriptor {
struct greybus_descriptor_module module; struct greybus_descriptor_module module;
struct greybus_descriptor_string string; struct greybus_descriptor_string string;
struct greybus_descriptor_interface interface; struct greybus_descriptor_interface interface;
struct greybus_descriptor_bundle bundle;
struct greybus_descriptor_cport cport; struct greybus_descriptor_cport cport;
struct greybus_descriptor_class class; struct greybus_descriptor_class class;
}; };
......
...@@ -26,6 +26,8 @@ static const char *get_descriptor_type_string(u8 type) ...@@ -26,6 +26,8 @@ static const char *get_descriptor_type_string(u8 type)
return "interface"; return "interface";
case GREYBUS_TYPE_CPORT: case GREYBUS_TYPE_CPORT:
return "cport"; return "cport";
case GREYBUS_TYPE_BUNDLE:
return "bundle";
case GREYBUS_TYPE_CLASS: case GREYBUS_TYPE_CLASS:
return "class"; return "class";
default: default:
......
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