From: Alex Elder Date: Tue, 9 Sep 2014 18:55:03 +0000 (-0500) Subject: greybus: switch to the term "manifest" X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=05ad189c23ad278c5586936bbb08147ac6f479be;p=openwrt%2Fstaging%2Fblogic.git greybus: switch to the term "manifest" We agreed to rename a few things to improve clarity. This patch implements one of those changes. The blob of data that describes what's relevant to Greybus within an Ara module will now be called the "module manifest." In addition, in the context of Greybus we'll also be calling what's in an Ara module a "module" or "Greybus module." So this patch renames some structures and updates some comments. It also renames "greybus_desc.h" to be "greybus_manifest.h", and renames greybus_new_device() to be greybus_new_module(). Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/ap.c b/drivers/staging/greybus/ap.c index a70404d7c1f1..aee47f50274d 100644 --- a/drivers/staging/greybus/ap.c +++ b/drivers/staging/greybus/ap.c @@ -17,7 +17,7 @@ #include #include #include "svc_msg.h" -#include "greybus_desc.h" +#include "greybus_manifest.h" #include "greybus.h" struct ap_msg { diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c index 76938cd00288..107e1fb75b8d 100644 --- a/drivers/staging/greybus/core.c +++ b/drivers/staging/greybus/core.c @@ -344,16 +344,16 @@ static int create_cport(struct greybus_device *gdev, } /** - * greybus_new_device: + * greybus_new_module: * - * Pass in a buffer that _should_ be a set of greybus descriptor fields and spit - * out a greybus device structure. + * Pass in a buffer that _should_ contain a Greybus module manifest + * and spit out a greybus device structure. */ -struct greybus_device *greybus_new_device(struct device *parent, +struct greybus_device *greybus_new_module(struct device *parent, int module_number, u8 *data, int size) { struct greybus_device *gdev; - struct greybus_descriptor_block_header *block; + struct greybus_manifest_header *header; struct greybus_descriptor *desc; int retval; int overall_size; @@ -361,8 +361,8 @@ struct greybus_device *greybus_new_device(struct device *parent, u8 version_major; u8 version_minor; - /* we have to have at _least_ the block header */ - if (size <= sizeof(struct greybus_descriptor_block_header)) + /* we have to have at _least_ the manifest header */ + if (size <= sizeof(struct greybus_manifest_header)) return NULL; gdev = kzalloc(sizeof(*gdev), GFP_KERNEL); @@ -379,21 +379,21 @@ struct greybus_device *greybus_new_device(struct device *parent, device_initialize(&gdev->dev); dev_set_name(&gdev->dev, "%d", module_number); - block = (struct greybus_descriptor_block_header *)data; - overall_size = le16_to_cpu(block->size); + header = (struct greybus_manifest_header *)data; + overall_size = le16_to_cpu(header->size); if (overall_size != size) { - dev_err(parent, "size != block header size, %d != %d\n", size, - overall_size); + dev_err(parent, "size != manifest header size, %d != %d\n", + size, overall_size); goto error; } - version_major = block->version_major; - version_minor = block->version_minor; + version_major = header->version_major; + version_minor = header->version_minor; // FIXME - check version major/minor here! - size -= sizeof(struct greybus_descriptor_block_header); - data += sizeof(struct greybus_descriptor_block_header); + size -= sizeof(struct greybus_manifest_header); + data += sizeof(struct greybus_manifest_header); while (size > 0) { desc = (struct greybus_descriptor *)data; desc_size = le16_to_cpu(desc->header.size); diff --git a/drivers/staging/greybus/greybus.h b/drivers/staging/greybus/greybus.h index 2b96917c8730..a8d13b55de18 100644 --- a/drivers/staging/greybus/greybus.h +++ b/drivers/staging/greybus/greybus.h @@ -16,7 +16,7 @@ #include #include #include "greybus_id.h" -#include "greybus_desc.h" +#include "greybus_manifest.h" #define GREYBUS_DEVICE_ID_MATCH_DEVICE \ @@ -209,7 +209,7 @@ void greybus_deregister(struct greybus_driver *driver); int greybus_disabled(void); -struct greybus_device *greybus_new_device(struct device *parent, +struct greybus_device *greybus_new_module(struct device *parent, int module_number, u8 *data, int size); void greybus_remove_device(struct greybus_device *gdev); diff --git a/drivers/staging/greybus/greybus_desc.h b/drivers/staging/greybus/greybus_desc.h deleted file mode 100644 index 592b6517d43b..000000000000 --- a/drivers/staging/greybus/greybus_desc.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Greybus device descriptor definition - * - * Defined in the "Greybus Application Protocol" document. - * See that document for any details on these values and structures. - * - * Copyright 2014 Google Inc. - */ - -#ifndef __GREYBUS_DESC_H -#define __GREYBUS_DESC_H - -#pragma pack(push, 1) - -struct greybus_descriptor_block_header { - __le16 size; - __u8 version_major; - __u8 version_minor; -}; - -enum greybus_descriptor_type { - GREYBUS_TYPE_INVALID = 0x0000, - GREYBUS_TYPE_FUNCTION = 0x0001, - GREYBUS_TYPE_MODULE_ID = 0x0002, - GREYBUS_TYPE_SERIAL_NUMBER = 0x0003, - GREYBUS_TYPE_STRING = 0x0004, - GREYBUS_TYPE_CPORT = 0x0005, -}; - -struct greybus_descriptor_header { - __le16 size; - __le16 type; /* enum greybus_descriptor_type */ -}; - -enum greybus_function_class { - GREYBUS_FUNCTION_CONTROL = 0x00, - GREYBUS_FUNCTION_USB = 0x01, - GREYBUS_FUNCTION_GPIO = 0x02, - GREYBUS_FUNCTION_SPI = 0x03, - GREYBUS_FUNCTION_UART = 0x04, - GREYBUS_FUNCTION_PWM = 0x05, - GREYBUS_FUNCTION_I2S = 0x06, - GREYBUS_FUNCTION_I2C = 0x07, - GREYBUS_FUNCTION_SDIO = 0x08, - GREYBUS_FUNCTION_HID = 0x09, - GREYBUS_FUNCTION_DISPLAY = 0x0a, - GREYBUS_FUNCTION_CAMERA = 0x0b, - GREYBUS_FUNCTION_SENSOR = 0x0c, - GREYBUS_FUNCTION_VENDOR = 0xff, -}; - -struct greybus_descriptor_function { - __le16 number; - __le16 cport; - __u8 class; /* enum greybus_function_class */ - __u8 subclass; - __u8 protocol; - __u8 reserved; -}; - -struct greybus_descriptor_module_id { - __le16 vendor; - __le16 product; - __le16 version; - __u8 vendor_stringid; - __u8 product_stringid; -}; - -struct greybus_descriptor_serial_number { - __le64 serial_number; -}; - -struct greybus_descriptor_string { - __le16 length; - __u8 id; - __u8 string[0]; -}; - -struct greybus_descriptor_cport { - __le16 number; - __le16 size; - __u8 speed; // FIXME - __u8 reserved; -}; - -struct greybus_descriptor { - struct greybus_descriptor_header header; - union { - struct greybus_descriptor_function function; - struct greybus_descriptor_module_id module_id; - struct greybus_descriptor_serial_number serial_number; - struct greybus_descriptor_string string; - struct greybus_descriptor_cport cport; - }; -}; - -#pragma pack(pop) - -#endif /* __GREYBUS_DESC_H */ diff --git a/drivers/staging/greybus/greybus_manifest.h b/drivers/staging/greybus/greybus_manifest.h new file mode 100644 index 000000000000..293451eee4d9 --- /dev/null +++ b/drivers/staging/greybus/greybus_manifest.h @@ -0,0 +1,99 @@ +/* + * Greybus device descriptor definition + * + * Defined in the "Greybus Application Protocol" document. + * See that document for any details on these values and structures. + * + * Copyright 2014 Google Inc. + */ + +#ifndef __GREYBUS_DESC_H +#define __GREYBUS_DESC_H + +#pragma pack(push, 1) + +struct greybus_manifest_header { + __le16 size; + __u8 version_major; + __u8 version_minor; +}; + +enum greybus_descriptor_type { + GREYBUS_TYPE_INVALID = 0x0000, + GREYBUS_TYPE_FUNCTION = 0x0001, + GREYBUS_TYPE_MODULE_ID = 0x0002, + GREYBUS_TYPE_SERIAL_NUMBER = 0x0003, + GREYBUS_TYPE_STRING = 0x0004, + GREYBUS_TYPE_CPORT = 0x0005, +}; + +struct greybus_descriptor_header { + __le16 size; + __le16 type; /* enum greybus_descriptor_type */ +}; + +enum greybus_function_class { + GREYBUS_FUNCTION_CONTROL = 0x00, + GREYBUS_FUNCTION_USB = 0x01, + GREYBUS_FUNCTION_GPIO = 0x02, + GREYBUS_FUNCTION_SPI = 0x03, + GREYBUS_FUNCTION_UART = 0x04, + GREYBUS_FUNCTION_PWM = 0x05, + GREYBUS_FUNCTION_I2S = 0x06, + GREYBUS_FUNCTION_I2C = 0x07, + GREYBUS_FUNCTION_SDIO = 0x08, + GREYBUS_FUNCTION_HID = 0x09, + GREYBUS_FUNCTION_DISPLAY = 0x0a, + GREYBUS_FUNCTION_CAMERA = 0x0b, + GREYBUS_FUNCTION_SENSOR = 0x0c, + GREYBUS_FUNCTION_VENDOR = 0xff, +}; + +struct greybus_descriptor_function { + __le16 number; + __le16 cport; + __u8 class; /* enum greybus_function_class */ + __u8 subclass; + __u8 protocol; + __u8 reserved; +}; + +struct greybus_descriptor_module_id { + __le16 vendor; + __le16 product; + __le16 version; + __u8 vendor_stringid; + __u8 product_stringid; +}; + +struct greybus_descriptor_serial_number { + __le64 serial_number; +}; + +struct greybus_descriptor_string { + __le16 length; + __u8 id; + __u8 string[0]; +}; + +struct greybus_descriptor_cport { + __le16 number; + __le16 size; + __u8 speed; // FIXME + __u8 reserved; +}; + +struct greybus_descriptor { + struct greybus_descriptor_header header; + union { + struct greybus_descriptor_function function; + struct greybus_descriptor_module_id module_id; + struct greybus_descriptor_serial_number serial_number; + struct greybus_descriptor_string string; + struct greybus_descriptor_cport cport; + }; +}; + +#pragma pack(pop) + +#endif /* __GREYBUS_DESC_H */