Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 1 | /* |
Alex Elder | 908a85d | 2014-09-24 05:16:16 -0500 | [diff] [blame] | 2 | * Greybus module manifest definition |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 3 | * |
Alex Elder | cb705e0 | 2014-09-24 05:16:17 -0500 | [diff] [blame] | 4 | * See "Greybus Application Protocol" document (version 0.1) for |
Alex Elder | 908a85d | 2014-09-24 05:16:16 -0500 | [diff] [blame] | 5 | * details on these values and structures. |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 6 | * |
| 7 | * Copyright 2014 Google Inc. |
Alex Elder | 908a85d | 2014-09-24 05:16:16 -0500 | [diff] [blame] | 8 | * |
| 9 | * Released under the GPLv2 only. |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Alex Elder | 1dd7f58 | 2014-09-26 20:55:32 -0500 | [diff] [blame] | 12 | #ifndef __GREYBUS_MANIFEST_H |
| 13 | #define __GREYBUS_MANIFEST_H |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 14 | |
Greg Kroah-Hartman | 48123e0 | 2014-09-02 10:51:56 -0700 | [diff] [blame] | 15 | #pragma pack(push, 1) |
| 16 | |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 17 | enum greybus_descriptor_type { |
Alex Elder | 72b0ffc | 2014-09-26 20:55:33 -0500 | [diff] [blame] | 18 | GREYBUS_TYPE_INVALID = 0x00, |
| 19 | GREYBUS_TYPE_MODULE = 0x01, |
Alex Elder | ecf7d57 | 2014-10-01 21:54:10 -0500 | [diff] [blame^] | 20 | GREYBUS_TYPE_DEVICE = 0x02, |
Alex Elder | 72b0ffc | 2014-09-26 20:55:33 -0500 | [diff] [blame] | 21 | GREYBUS_TYPE_CLASS = 0x03, |
| 22 | GREYBUS_TYPE_STRING = 0x04, |
| 23 | GREYBUS_TYPE_CPORT = 0x05, |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 24 | }; |
| 25 | |
Matt Porter | 097724c | 2014-09-26 20:49:50 -0500 | [diff] [blame] | 26 | enum greybus_function_type { |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 27 | GREYBUS_FUNCTION_CONTROL = 0x00, |
| 28 | GREYBUS_FUNCTION_USB = 0x01, |
| 29 | GREYBUS_FUNCTION_GPIO = 0x02, |
| 30 | GREYBUS_FUNCTION_SPI = 0x03, |
| 31 | GREYBUS_FUNCTION_UART = 0x04, |
| 32 | GREYBUS_FUNCTION_PWM = 0x05, |
| 33 | GREYBUS_FUNCTION_I2S = 0x06, |
| 34 | GREYBUS_FUNCTION_I2C = 0x07, |
| 35 | GREYBUS_FUNCTION_SDIO = 0x08, |
| 36 | GREYBUS_FUNCTION_HID = 0x09, |
| 37 | GREYBUS_FUNCTION_DISPLAY = 0x0a, |
| 38 | GREYBUS_FUNCTION_CAMERA = 0x0b, |
| 39 | GREYBUS_FUNCTION_SENSOR = 0x0c, |
| 40 | GREYBUS_FUNCTION_VENDOR = 0xff, |
| 41 | }; |
| 42 | |
Alex Elder | ecf7d57 | 2014-10-01 21:54:10 -0500 | [diff] [blame^] | 43 | /* |
| 44 | * A module descriptor describes information about a module as a |
| 45 | * whole, *not* the functions within it. |
| 46 | */ |
Matt Porter | 6d63ff7 | 2014-09-26 20:49:48 -0500 | [diff] [blame] | 47 | struct greybus_descriptor_module { |
Greg Kroah-Hartman | d587780 | 2014-09-01 10:59:08 -0700 | [diff] [blame] | 48 | __le16 vendor; |
| 49 | __le16 product; |
| 50 | __le16 version; |
Matt Porter | 4fc6454 | 2014-09-26 20:49:49 -0500 | [diff] [blame] | 51 | __le64 serial_number; |
Greg Kroah-Hartman | d587780 | 2014-09-01 10:59:08 -0700 | [diff] [blame] | 52 | __u8 vendor_stringid; |
| 53 | __u8 product_stringid; |
| 54 | }; |
| 55 | |
Alex Elder | ecf7d57 | 2014-10-01 21:54:10 -0500 | [diff] [blame^] | 56 | /* |
| 57 | * A UniPro device normally supports a range of 32 CPorts (0..31). |
| 58 | * It is possible to support more than this by having a UniPro |
| 59 | * switch treat one device as if it were more than one. E.g., |
| 60 | * allocate 3 device ids (rather than the normal--1) to physical |
| 61 | * device 5, and configure the switch to route all packets destined |
| 62 | * for "encoded" device ids 5, 6, and 7 to physical device 5. |
| 63 | * Device 5 uses the encoded device id in incoming UniPro packets to |
| 64 | * determine which bank of 32 CPorts should receive the UniPro |
| 65 | * segment. |
| 66 | * |
| 67 | * The "scale" field in this structure is used to define the number |
| 68 | * of encoded device ids should be allocated for this physical |
| 69 | * device. Scale is normally 1, to represent 32 available CPorts. |
| 70 | * A scale value 2 represents up to 64 CPorts; scale value 3 |
| 71 | * represents up to 96 CPorts, and so on. |
| 72 | */ |
| 73 | struct greybus_descriptor_interface { |
| 74 | __u8 id; /* module-relative id (0..) */ |
| 75 | __u8 scale; /* indicates range of of CPorts supported */ |
| 76 | /* UniPro gear, number of in/out lanes */ |
| 77 | }; |
| 78 | |
| 79 | struct greybus_descriptor_cport { |
| 80 | __le16 id; |
| 81 | __u8 function_type; /* enum greybus_function_type */ |
| 82 | }; |
| 83 | |
Greg Kroah-Hartman | d587780 | 2014-09-01 10:59:08 -0700 | [diff] [blame] | 84 | struct greybus_descriptor_string { |
Matt Porter | cbd0fd7 | 2014-09-26 20:49:51 -0500 | [diff] [blame] | 85 | __u8 length; |
Greg Kroah-Hartman | d587780 | 2014-09-01 10:59:08 -0700 | [diff] [blame] | 86 | __u8 id; |
| 87 | __u8 string[0]; |
| 88 | }; |
| 89 | |
Alex Elder | ecf7d57 | 2014-10-01 21:54:10 -0500 | [diff] [blame^] | 90 | struct greybus_descriptor_header { |
| 91 | __le16 size; |
| 92 | __u8 type; /* enum greybus_descriptor_type */ |
Greg Kroah-Hartman | d587780 | 2014-09-01 10:59:08 -0700 | [diff] [blame] | 93 | }; |
| 94 | |
Greg Kroah-Hartman | 6dca7b9 | 2014-09-01 13:42:43 -0700 | [diff] [blame] | 95 | struct greybus_descriptor { |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 96 | struct greybus_descriptor_header header; |
| 97 | union { |
Matt Porter | 6d63ff7 | 2014-09-26 20:49:48 -0500 | [diff] [blame] | 98 | struct greybus_descriptor_module module; |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 99 | struct greybus_descriptor_string string; |
Alex Elder | ecf7d57 | 2014-10-01 21:54:10 -0500 | [diff] [blame^] | 100 | struct greybus_descriptor_interface interface; |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 101 | struct greybus_descriptor_cport cport; |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 102 | }; |
| 103 | }; |
| 104 | |
Alex Elder | ecf7d57 | 2014-10-01 21:54:10 -0500 | [diff] [blame^] | 105 | struct greybus_manifest_header { |
| 106 | __le16 size; |
| 107 | __u8 version_major; |
| 108 | __u8 version_minor; |
| 109 | }; |
| 110 | |
Alex Elder | badad68 | 2014-09-09 13:55:04 -0500 | [diff] [blame] | 111 | struct greybus_manifest { |
| 112 | struct greybus_manifest_header header; |
| 113 | struct greybus_descriptor descriptors[0]; |
| 114 | }; |
| 115 | |
Greg Kroah-Hartman | 48123e0 | 2014-09-02 10:51:56 -0700 | [diff] [blame] | 116 | #pragma pack(pop) |
| 117 | |
Alex Elder | 1dd7f58 | 2014-09-26 20:55:32 -0500 | [diff] [blame] | 118 | #endif /* __GREYBUS_MANIFEST_H */ |