greybus: descriptor type updates
Some more updates to the definition of a manifest descriptor.
- We get rid of function descriptors. The type of function is
easily specified with the CPort it uses.
- Add a new interface descriptor type.
- Clean up the CPort descriptor structure, eliminating fields
that serve no purpose and adding the function id field
The sysfs stuff will be updated a little later to add entries
for the Greybus interfaces associated with modules.
Rearrange the order of a few things in "greybus_manifest.h".
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
diff --git a/drivers/staging/greybus/greybus_manifest.h b/drivers/staging/greybus/greybus_manifest.h
index 4d801d7..6118999 100644
--- a/drivers/staging/greybus/greybus_manifest.h
+++ b/drivers/staging/greybus/greybus_manifest.h
@@ -14,26 +14,15 @@
#pragma pack(push, 1)
-struct greybus_manifest_header {
- __le16 size;
- __u8 version_major;
- __u8 version_minor;
-};
-
enum greybus_descriptor_type {
GREYBUS_TYPE_INVALID = 0x00,
GREYBUS_TYPE_MODULE = 0x01,
- GREYBUS_TYPE_FUNCTION = 0x02,
+ GREYBUS_TYPE_DEVICE = 0x02,
GREYBUS_TYPE_CLASS = 0x03,
GREYBUS_TYPE_STRING = 0x04,
GREYBUS_TYPE_CPORT = 0x05,
};
-struct greybus_descriptor_header {
- __le16 size;
- __u8 type; /* enum greybus_descriptor_type */
-};
-
enum greybus_function_type {
GREYBUS_FUNCTION_CONTROL = 0x00,
GREYBUS_FUNCTION_USB = 0x01,
@@ -51,11 +40,10 @@
GREYBUS_FUNCTION_VENDOR = 0xff,
};
-struct greybus_descriptor_function {
- __le16 cport;
- __u8 function_type; /* enum greybus_function_type */
-};
-
+/*
+ * A module descriptor describes information about a module as a
+ * whole, *not* the functions within it.
+ */
struct greybus_descriptor_module {
__le16 vendor;
__le16 product;
@@ -65,26 +53,61 @@
__u8 product_stringid;
};
+/*
+ * A UniPro device normally supports a range of 32 CPorts (0..31).
+ * It is possible to support more than this by having a UniPro
+ * switch treat one device as if it were more than one. E.g.,
+ * allocate 3 device ids (rather than the normal--1) to physical
+ * device 5, and configure the switch to route all packets destined
+ * for "encoded" device ids 5, 6, and 7 to physical device 5.
+ * Device 5 uses the encoded device id in incoming UniPro packets to
+ * determine which bank of 32 CPorts should receive the UniPro
+ * segment.
+ *
+ * The "scale" field in this structure is used to define the number
+ * of encoded device ids should be allocated for this physical
+ * device. Scale is normally 1, to represent 32 available CPorts.
+ * A scale value 2 represents up to 64 CPorts; scale value 3
+ * represents up to 96 CPorts, and so on.
+ */
+struct greybus_descriptor_interface {
+ __u8 id; /* module-relative id (0..) */
+ __u8 scale; /* indicates range of of CPorts supported */
+ /* UniPro gear, number of in/out lanes */
+};
+
+struct greybus_descriptor_cport {
+ __le16 id;
+ __u8 function_type; /* enum greybus_function_type */
+};
+
struct greybus_descriptor_string {
__u8 length;
__u8 id;
__u8 string[0];
};
-struct greybus_descriptor_cport {
- __le16 id;
+struct greybus_descriptor_header {
+ __le16 size;
+ __u8 type; /* enum greybus_descriptor_type */
};
struct greybus_descriptor {
struct greybus_descriptor_header header;
union {
- struct greybus_descriptor_function function;
struct greybus_descriptor_module module;
struct greybus_descriptor_string string;
+ struct greybus_descriptor_interface interface;
struct greybus_descriptor_cport cport;
};
};
+struct greybus_manifest_header {
+ __le16 size;
+ __u8 version_major;
+ __u8 version_minor;
+};
+
struct greybus_manifest {
struct greybus_manifest_header header;
struct greybus_descriptor descriptors[0];