greybus: es2: add support for greybus cport flags
[cascardo/linux.git] / drivers / staging / greybus / greybus_protocols.h
index 06888e0..327d01f 100644 (file)
@@ -95,9 +95,9 @@ struct gb_operation_msg_hdr {
 } __packed;
 
 
-/* Generic request numbers supported by all modules */
-#define GB_REQUEST_TYPE_INVALID                        0x00
-#define GB_REQUEST_TYPE_PROTOCOL_VERSION       0x01
+/* Generic request types */
+#define GB_REQUEST_TYPE_PING                   0x00
+#define GB_REQUEST_TYPE_INVALID                        0x7f
 
 struct gb_protocol_version_request {
        __u8    major;
@@ -121,8 +121,11 @@ struct gb_protocol_version_response {
 #define GB_CONTROL_TYPE_TIMESYNC_ENABLE                0x07
 #define GB_CONTROL_TYPE_TIMESYNC_DISABLE       0x08
 #define GB_CONTROL_TYPE_TIMESYNC_AUTHORITATIVE 0x09
-#define GB_CONTROL_TYPE_INTERFACE_VERSION      0x0a
+/*     Unused                                  0x0a */
 #define GB_CONTROL_TYPE_BUNDLE_VERSION         0x0b
+#define GB_CONTROL_TYPE_DISCONNECTING          0x0c
+#define GB_CONTROL_TYPE_TIMESYNC_GET_LAST_EVENT        0x0d
+#define GB_CONTROL_TYPE_MODE_SWITCH            0x0e
 
 struct gb_control_version_request {
        __u8    major;
@@ -158,16 +161,15 @@ struct gb_control_connected_request {
        __le16                  cport_id;
 } __packed;
 
-struct gb_control_disconnected_request {
+struct gb_control_disconnecting_request {
        __le16                  cport_id;
 } __packed;
-/* Control protocol [dis]connected response has no payload */
+/* disconnecting response has no payload */
 
-/* Control protocol interface version request has no payload */
-struct gb_control_interface_version_response {
-       __le16                  major;
-       __le16                  minor;
+struct gb_control_disconnected_request {
+       __le16                  cport_id;
 } __packed;
+/* Control protocol [dis]connected response has no payload */
 
 #define GB_TIMESYNC_MAX_STROBES                        0x04
 
@@ -180,102 +182,233 @@ struct gb_control_timesync_enable_request {
 /* timesync enable response has no payload */
 
 struct gb_control_timesync_authoritative_request {
-       __u64   frame_time[GB_TIMESYNC_MAX_STROBES];
+       __le64  frame_time[GB_TIMESYNC_MAX_STROBES];
 } __packed;
 /* timesync authoritative response has no payload */
 
+/* timesync get_last_event_request has no payload */
+struct gb_control_timesync_get_last_event_response {
+       __le64  frame_time;
+} __packed;
+
 /* APBridge protocol */
 
 /* request APB1 log */
-#define GB_APB_REQUEST_LOG             0x02
+#define GB_APB_REQUEST_LOG                     0x02
 
 /* request to map a cport to bulk in and bulk out endpoints */
-#define GB_APB_REQUEST_EP_MAPPING      0x03
+#define GB_APB_REQUEST_EP_MAPPING              0x03
 
 /* request to get the number of cports available */
-#define GB_APB_REQUEST_CPORT_COUNT     0x04
+#define GB_APB_REQUEST_CPORT_COUNT             0x04
 
 /* request to reset a cport state */
-#define GB_APB_REQUEST_RESET_CPORT     0x05
+#define GB_APB_REQUEST_RESET_CPORT             0x05
 
 /* request to time the latency of messages on a given cport */
-#define GB_APB_REQUEST_LATENCY_TAG_EN  0x06
-#define GB_APB_REQUEST_LATENCY_TAG_DIS 0x07
+#define GB_APB_REQUEST_LATENCY_TAG_EN          0x06
+#define GB_APB_REQUEST_LATENCY_TAG_DIS         0x07
 
 /* request to control the CSI transmitter */
-#define GB_APB_REQUEST_CSI_TX_CONTROL  0x08
+#define GB_APB_REQUEST_CSI_TX_CONTROL          0x08
 
 /* request to control the CSI transmitter */
-#define GB_APB_REQUEST_AUDIO_CONTROL   0x09
+#define GB_APB_REQUEST_AUDIO_CONTROL           0x09
 
 /* vendor requests to enable/disable CPort features */
-#define GB_APB_REQUEST_CPORT_FEAT_EN   0x0b
-#define GB_APB_REQUEST_CPORT_FEAT_DIS  0x0c
+#define GB_APB_REQUEST_CPORT_FEAT_EN           0x0b
+#define GB_APB_REQUEST_CPORT_FEAT_DIS          0x0c
+
+/* TimeSync commands */
+#define REQUEST_TIMESYNC_ENABLE                        0x0d
+#define REQUEST_TIMESYNC_DISABLE               0x0e
+#define REQUEST_TIMESYNC_AUTHORITATIVE         0x0f
+#define REQUEST_TIMESYNC_GET_LAST_EVENT                0x10
+
+/* requests to set Greybus CPort flags */
+#define GB_APB_REQUEST_CPORT_FLAGS             0x11
+
+struct gb_apb_request_cport_flags {
+       u32     flags;
+#define GB_APB_CPORT_FLAG_CONTROL              0x01
+#define GB_APB_CPORT_FLAG_HIGH_PRIO            0x02
+} __packed;
+
+
+/* Firmware Download Protocol */
+
+/* Request Types */
+#define GB_FW_DOWNLOAD_TYPE_FIND_FIRMWARE      0x01
+#define GB_FW_DOWNLOAD_TYPE_FETCH_FIRMWARE     0x02
+#define GB_FW_DOWNLOAD_TYPE_RELEASE_FIRMWARE   0x03
+
+#define GB_FIRMWARE_TAG_MAX_LEN                        10
+
+/* firmware download find firmware request/response */
+struct gb_fw_download_find_firmware_request {
+       __u8                    firmware_tag[GB_FIRMWARE_TAG_MAX_LEN];
+} __packed;
+
+struct gb_fw_download_find_firmware_response {
+       __u8                    firmware_id;
+       __le32                  size;
+} __packed;
+
+/* firmware download fetch firmware request/response */
+struct gb_fw_download_fetch_firmware_request {
+       __u8                    firmware_id;
+       __le32                  offset;
+       __le32                  size;
+} __packed;
+
+struct gb_fw_download_fetch_firmware_response {
+       __u8                    data[0];
+} __packed;
+
+/* firmware download release firmware request */
+struct gb_fw_download_release_firmware_request {
+       __u8                    firmware_id;
+} __packed;
+/* firmware download release firmware response has no payload */
+
 
-/* Firmware Protocol */
+/* Firmware Management Protocol */
 
-/* Version of the Greybus firmware protocol we support */
-#define GB_FIRMWARE_VERSION_MAJOR              0x00
-#define GB_FIRMWARE_VERSION_MINOR              0x01
+/* Request Types */
+#define GB_FW_MGMT_TYPE_INTERFACE_FW_VERSION   0x01
+#define GB_FW_MGMT_TYPE_LOAD_AND_VALIDATE_FW   0x02
+#define GB_FW_MGMT_TYPE_LOADED_FW              0x03
+#define GB_FW_MGMT_TYPE_BACKEND_FW_VERSION     0x04
+#define GB_FW_MGMT_TYPE_BACKEND_FW_UPDATE      0x05
+#define GB_FW_MGMT_TYPE_BACKEND_FW_UPDATED     0x06
 
-/* Greybus firmware request types */
-#define GB_FIRMWARE_TYPE_VERSION               0x01
-#define GB_FIRMWARE_TYPE_FIRMWARE_SIZE         0x02
-#define GB_FIRMWARE_TYPE_GET_FIRMWARE          0x03
-#define GB_FIRMWARE_TYPE_READY_TO_BOOT         0x04
-#define GB_FIRMWARE_TYPE_AP_READY              0x05    /* Request with no-payload */
-#define GB_FIRMWARE_TYPE_GET_VID_PID           0x06    /* Request with no-payload */
+#define GB_FW_LOAD_METHOD_UNIPRO               0x01
+#define GB_FW_LOAD_METHOD_INTERNAL             0x02
 
-/* Greybus firmware boot stages */
-#define GB_FIRMWARE_BOOT_STAGE_ONE             0x01 /* Reserved for the boot ROM */
-#define GB_FIRMWARE_BOOT_STAGE_TWO             0x02 /* Firmware package to be loaded by the boot ROM */
-#define GB_FIRMWARE_BOOT_STAGE_THREE           0x03 /* Module personality package loaded by Stage 2 firmware */
+#define GB_FW_LOAD_STATUS_FAILED               0x00
+#define GB_FW_LOAD_STATUS_UNVALIDATED          0x01
+#define GB_FW_LOAD_STATUS_VALIDATED            0x02
+#define GB_FW_LOAD_STATUS_VALIDATION_FAILED    0x03
 
-/* Greybus firmware ready to boot status */
-#define GB_FIRMWARE_BOOT_STATUS_INVALID                0x00 /* Firmware blob could not be validated */
-#define GB_FIRMWARE_BOOT_STATUS_INSECURE       0x01 /* Firmware blob is valid but insecure */
-#define GB_FIRMWARE_BOOT_STATUS_SECURE         0x02 /* Firmware blob is valid and secure */
+#define GB_FW_BACKEND_FW_STATUS_SUCCESS                0x01
+#define GB_FW_BACKEND_FW_STATUS_FAIL_FIND      0x02
+#define GB_FW_BACKEND_FW_STATUS_FAIL_FETCH     0x03
+#define GB_FW_BACKEND_FW_STATUS_FAIL_WRITE     0x04
+#define GB_FW_BACKEND_FW_STATUS_INT            0x05
 
-/* Max firmware data fetch size in bytes */
-#define GB_FIRMWARE_FETCH_MAX                  2000
+/* firmware management interface firmware version request has no payload */
+struct gb_fw_mgmt_interface_fw_version_response {
+       __u8                    firmware_tag[GB_FIRMWARE_TAG_MAX_LEN];
+       __le16                  major;
+       __le16                  minor;
+} __packed;
 
-struct gb_firmware_version_request {
+/* firmware management load and validate firmware request/response */
+struct gb_fw_mgmt_load_and_validate_fw_request {
+       __u8                    request_id;
+       __u8                    load_method;
+       __u8                    firmware_tag[GB_FIRMWARE_TAG_MAX_LEN];
+} __packed;
+/* firmware management load and validate firmware response has no payload*/
+
+/* firmware management loaded firmware request */
+struct gb_fw_mgmt_loaded_fw_request {
+       __u8                    request_id;
+       __u8                    status;
+       __le16                  major;
+       __le16                  minor;
+} __packed;
+/* firmware management loaded firmware response has no payload */
+
+/* firmware management backend firmware version request/response */
+struct gb_fw_mgmt_backend_fw_version_request {
+       __u8                    firmware_tag[GB_FIRMWARE_TAG_MAX_LEN];
+} __packed;
+
+struct gb_fw_mgmt_backend_fw_version_response {
+       __le16                  major;
+       __le16                  minor;
+} __packed;
+
+/* firmware management backend firmware update request */
+struct gb_fw_mgmt_backend_fw_update_request {
+       __u8                    request_id;
+       __u8                    firmware_tag[GB_FIRMWARE_TAG_MAX_LEN];
+} __packed;
+/* firmware management backend firmware update response has no payload */
+
+/* firmware management backend firmware updated request */
+struct gb_fw_mgmt_backend_fw_updated_request {
+       __u8                    request_id;
+       __u8                    status;
+} __packed;
+/* firmware management backend firmware updated response has no payload */
+
+
+/* Bootrom Protocol */
+
+/* Version of the Greybus bootrom protocol we support */
+#define GB_BOOTROM_VERSION_MAJOR               0x00
+#define GB_BOOTROM_VERSION_MINOR               0x01
+
+/* Greybus bootrom request types */
+#define GB_BOOTROM_TYPE_VERSION                        0x01
+#define GB_BOOTROM_TYPE_FIRMWARE_SIZE          0x02
+#define GB_BOOTROM_TYPE_GET_FIRMWARE           0x03
+#define GB_BOOTROM_TYPE_READY_TO_BOOT          0x04
+#define GB_BOOTROM_TYPE_AP_READY               0x05    /* Request with no-payload */
+#define GB_BOOTROM_TYPE_GET_VID_PID            0x06    /* Request with no-payload */
+
+/* Greybus bootrom boot stages */
+#define GB_BOOTROM_BOOT_STAGE_ONE              0x01 /* Reserved for the boot ROM */
+#define GB_BOOTROM_BOOT_STAGE_TWO              0x02 /* Bootrom package to be loaded by the boot ROM */
+#define GB_BOOTROM_BOOT_STAGE_THREE            0x03 /* Module personality package loaded by Stage 2 firmware */
+
+/* Greybus bootrom ready to boot status */
+#define GB_BOOTROM_BOOT_STATUS_INVALID         0x00 /* Firmware blob could not be validated */
+#define GB_BOOTROM_BOOT_STATUS_INSECURE                0x01 /* Firmware blob is valid but insecure */
+#define GB_BOOTROM_BOOT_STATUS_SECURE          0x02 /* Firmware blob is valid and secure */
+
+/* Max bootrom data fetch size in bytes */
+#define GB_BOOTROM_FETCH_MAX                   2000
+
+struct gb_bootrom_version_request {
        __u8    major;
        __u8    minor;
 } __packed;
 
-struct gb_firmware_version_response {
+struct gb_bootrom_version_response {
        __u8    major;
        __u8    minor;
 } __packed;
 
-/* Firmware protocol firmware size request/response */
-struct gb_firmware_size_request {
+/* Bootrom protocol firmware size request/response */
+struct gb_bootrom_firmware_size_request {
        __u8                    stage;
 } __packed;
 
-struct gb_firmware_size_response {
+struct gb_bootrom_firmware_size_response {
        __le32                  size;
 } __packed;
 
-/* Firmware protocol get firmware request/response */
-struct gb_firmware_get_firmware_request {
+/* Bootrom protocol get firmware request/response */
+struct gb_bootrom_get_firmware_request {
        __le32                  offset;
        __le32                  size;
 } __packed;
 
-struct gb_firmware_get_firmware_response {
+struct gb_bootrom_get_firmware_response {
        __u8                    data[0];
 } __packed;
 
-/* Firmware protocol Ready to boot request */
-struct gb_firmware_ready_to_boot_request {
+/* Bootrom protocol Ready to boot request */
+struct gb_bootrom_ready_to_boot_request {
        __u8                    status;
 } __packed;
-/* Firmware protocol Ready to boot response has no payload */
+/* Bootrom protocol Ready to boot response has no payload */
 
-/* Firmware protocol get VID/PID request has no payload */
-struct gb_firmware_get_vid_pid_response {
+/* Bootrom protocol get VID/PID request has no payload */
+struct gb_bootrom_get_vid_pid_response {
        __le32                  vendor_id;
        __le32                  product_id;
 } __packed;
@@ -283,10 +416,6 @@ struct gb_firmware_get_vid_pid_response {
 
 /* Power Supply */
 
-/* Version of the Greybus power supply protocol we support */
-#define GB_POWER_SUPPLY_VERSION_MAJOR          0x00
-#define GB_POWER_SUPPLY_VERSION_MINOR          0x01
-
 /* Greybus power supply request types */
 #define GB_POWER_SUPPLY_TYPE_GET_SUPPLIES              0x02
 #define GB_POWER_SUPPLY_TYPE_GET_DESCRIPTION           0x03
@@ -448,10 +577,6 @@ struct gb_power_supply_event_request {
 
 /* HID */
 
-/* Version of the Greybus hid protocol we support */
-#define GB_HID_VERSION_MAJOR           0x00
-#define GB_HID_VERSION_MINOR           0x01
-
 /* Greybus HID operation types */
 #define GB_HID_TYPE_GET_DESC           0x02
 #define GB_HID_TYPE_GET_REPORT_DESC    0x03
@@ -498,10 +623,6 @@ struct gb_hid_input_report_request {
 
 /* I2C */
 
-/* Version of the Greybus i2c protocol we support */
-#define GB_I2C_VERSION_MAJOR           0x00
-#define GB_I2C_VERSION_MINOR           0x01
-
 /* Greybus i2c request types */
 #define GB_I2C_TYPE_FUNCTIONALITY      0x02
 #define GB_I2C_TYPE_TRANSFER           0x05
@@ -538,10 +659,6 @@ struct gb_i2c_transfer_response {
 
 /* GPIO */
 
-/* Version of the Greybus GPIO protocol we support */
-#define GB_GPIO_VERSION_MAJOR          0x00
-#define GB_GPIO_VERSION_MINOR          0x01
-
 /* Greybus GPIO request types */
 #define GB_GPIO_TYPE_LINE_COUNT                0x02
 #define GB_GPIO_TYPE_ACTIVATE          0x03
@@ -641,10 +758,6 @@ struct gb_gpio_irq_event_request {
 
 /* PWM */
 
-/* Version of the Greybus PWM protocol we support */
-#define GB_PWM_VERSION_MAJOR           0x00
-#define GB_PWM_VERSION_MINOR           0x01
-
 /* Greybus PWM operation types */
 #define GB_PWM_TYPE_PWM_COUNT          0x02
 #define GB_PWM_TYPE_ACTIVATE           0x03
@@ -688,10 +801,6 @@ struct gb_pwm_disable_request {
 
 /* SPI */
 
-/* Version of the Greybus spi protocol we support */
-#define GB_SPI_VERSION_MAJOR           0x00
-#define GB_SPI_VERSION_MINOR           0x01
-
 /* Should match up with modes in linux/spi/spi.h */
 #define GB_SPI_MODE_CPHA               0x01            /* clock phase */
 #define GB_SPI_MODE_CPOL               0x02            /* clock polarity */
@@ -759,9 +868,10 @@ struct gb_spi_transfer {
        __le16          delay_usecs;
        __u8            cs_change;
        __u8            bits_per_word;
-       __u8            rdwr;
+       __u8            xfer_flags;
 #define GB_SPI_XFER_READ       0x01
 #define GB_SPI_XFER_WRITE      0x02
+#define GB_SPI_XFER_INPROGRESS 0x04
 } __packed;
 
 struct gb_spi_transfer_request {
@@ -780,10 +890,9 @@ struct gb_spi_transfer_response {
 #define GB_SVC_VERSION_MINOR           0x01
 
 /* Greybus SVC request types */
+#define GB_SVC_TYPE_PROTOCOL_VERSION           0x01
 #define GB_SVC_TYPE_SVC_HELLO                  0x02
 #define GB_SVC_TYPE_INTF_DEVICE_ID             0x03
-#define GB_SVC_TYPE_INTF_HOTPLUG               0x04
-#define GB_SVC_TYPE_INTF_HOT_UNPLUG            0x05
 #define GB_SVC_TYPE_INTF_RESET                 0x06
 #define GB_SVC_TYPE_CONN_CREATE                        0x07
 #define GB_SVC_TYPE_CONN_DESTROY               0x08
@@ -798,11 +907,52 @@ struct gb_spi_transfer_response {
 #define GB_SVC_TYPE_INTF_EJECT                 0x11
 #define GB_SVC_TYPE_KEY_EVENT                  0x12
 #define GB_SVC_TYPE_PING                       0x13
+#define GB_SVC_TYPE_PWRMON_RAIL_COUNT_GET      0x14
+#define GB_SVC_TYPE_PWRMON_RAIL_NAMES_GET      0x15
+#define GB_SVC_TYPE_PWRMON_SAMPLE_GET          0x16
+#define GB_SVC_TYPE_PWRMON_INTF_SAMPLE_GET     0x17
+#define GB_SVC_TYPE_TIMESYNC_WAKE_PINS_ACQUIRE 0x18
+#define GB_SVC_TYPE_TIMESYNC_WAKE_PINS_RELEASE 0x19
+#define GB_SVC_TYPE_TIMESYNC_PING              0x1a
+#define GB_SVC_TYPE_CONN_QUIESCING             0x1e
+#define GB_SVC_TYPE_MODULE_INSERTED            0x1f
+#define GB_SVC_TYPE_MODULE_REMOVED             0x20
+#define GB_SVC_TYPE_INTF_VSYS_ENABLE           0x21
+#define GB_SVC_TYPE_INTF_VSYS_DISABLE          0x22
+#define GB_SVC_TYPE_INTF_REFCLK_ENABLE         0x23
+#define GB_SVC_TYPE_INTF_REFCLK_DISABLE                0x24
+#define GB_SVC_TYPE_INTF_UNIPRO_ENABLE         0x25
+#define GB_SVC_TYPE_INTF_UNIPRO_DISABLE                0x26
+#define GB_SVC_TYPE_INTF_ACTIVATE              0x27
+#define GB_SVC_TYPE_INTF_MAILBOX_EVENT         0x29
+
+/* Greybus SVC protocol status values */
+#define GB_SVC_OP_SUCCESS                      0x00
+#define GB_SVC_OP_UNKNOWN_ERROR                        0x01
+#define GB_SVC_INTF_NOT_DETECTED               0x02
+#define GB_SVC_INTF_NO_UPRO_LINK               0x03
+#define GB_SVC_INTF_UPRO_NOT_DOWN              0x04
+#define GB_SVC_INTF_UPRO_NOT_HIBERNATED                0x05
+#define GB_SVC_INTF_NO_V_SYS                   0x06
+#define GB_SVC_INTF_V_CHG                      0x07
+#define GB_SVC_INTF_WAKE_BUSY                  0x08
+#define GB_SVC_INTF_NO_REFCLK                  0x09
+#define GB_SVC_INTF_RELEASING                  0x0a
+#define GB_SVC_INTF_NO_ORDER                   0x0b
+#define GB_SVC_INTF_MBOX_SET                   0x0c
+#define GB_SVC_INTF_BAD_MBOX                   0x0d
+#define GB_SVC_INTF_OP_TIMEOUT                 0x0e
+#define GB_SVC_PWRMON_OP_NOT_PRESENT           0x0f
+
+struct gb_svc_version_request {
+       __u8    major;
+       __u8    minor;
+} __packed;
 
-/*
- * SVC version request/response has the same payload as
- * gb_protocol_version_request/response.
- */
+struct gb_svc_version_response {
+       __u8    major;
+       __u8    minor;
+} __packed;
 
 /* SVC protocol hello request */
 struct gb_svc_hello_request {
@@ -817,23 +967,6 @@ struct gb_svc_intf_device_id_request {
 } __packed;
 /* device id response has no payload */
 
-struct gb_svc_intf_hotplug_request {
-       __u8    intf_id;
-       struct {
-               __le32  ddbl1_mfr_id;
-               __le32  ddbl1_prod_id;
-               __le32  ara_vend_id;
-               __le32  ara_prod_id;
-               __le64  serial_number;
-       } data;
-} __packed;
-/* hotplug response has no payload */
-
-struct gb_svc_intf_hot_unplug_request {
-       __u8    intf_id;
-} __packed;
-/* hot unplug response has no payload */
-
 struct gb_svc_intf_reset_request {
        __u8    intf_id;
 } __packed;
@@ -905,20 +1038,70 @@ struct gb_svc_route_destroy_request {
 } __packed;
 /* route destroy response has no payload */
 
+/* used for svc_intf_vsys_{enable,disable} */
+struct gb_svc_intf_vsys_request {
+       __u8    intf_id;
+} __packed;
+
+struct gb_svc_intf_vsys_response {
+       __u8    result_code;
+#define GB_SVC_INTF_VSYS_OK                            0x00
+       /* 0x01 is reserved */
+#define GB_SVC_INTF_VSYS_FAIL                          0x02
+} __packed;
+
+/* used for svc_intf_refclk_{enable,disable} */
+struct gb_svc_intf_refclk_request {
+       __u8    intf_id;
+} __packed;
+
+struct gb_svc_intf_refclk_response {
+       __u8    result_code;
+#define GB_SVC_INTF_REFCLK_OK                          0x00
+       /* 0x01 is reserved */
+#define GB_SVC_INTF_REFCLK_FAIL                                0x02
+} __packed;
+
+/* used for svc_intf_unipro_{enable,disable} */
+struct gb_svc_intf_unipro_request {
+       __u8    intf_id;
+} __packed;
+
+struct gb_svc_intf_unipro_response {
+       __u8    result_code;
+#define GB_SVC_INTF_UNIPRO_OK                          0x00
+       /* 0x01 is reserved */
+#define GB_SVC_INTF_UNIPRO_FAIL                                0x02
+#define GB_SVC_INTF_UNIPRO_NOT_OFF                     0x03
+} __packed;
+
 struct gb_svc_timesync_enable_request {
        __u8    count;
-       __u64   frame_time;
-       __u32   strobe_delay;
-       __u32   strobe_mask;
-       __u32   refclk;
+       __le64  frame_time;
+       __le32  strobe_delay;
+       __le32  refclk;
 } __packed;
 /* timesync enable response has no payload */
 
 /* timesync authoritative request has no payload */
 struct gb_svc_timesync_authoritative_response {
-       __u64   frame_time[GB_TIMESYNC_MAX_STROBES];
+       __le64  frame_time[GB_TIMESYNC_MAX_STROBES];
+};
+
+struct gb_svc_timesync_wake_pins_acquire_request {
+       __le32  strobe_mask;
 };
 
+/* timesync wake pins acquire response has no payload */
+
+/* timesync wake pins release request has no payload */
+/* timesync wake pins release response has no payload */
+
+/* timesync svc ping request has no payload */
+struct gb_svc_timesync_ping_response {
+       __le64  frame_time;
+} __packed;
+
 #define GB_SVC_UNIPRO_FAST_MODE                        0x01
 #define GB_SVC_UNIPRO_SLOW_MODE                        0x02
 #define GB_SVC_UNIPRO_FAST_AUTO_MODE           0x04
@@ -927,6 +1110,13 @@ struct gb_svc_timesync_authoritative_response {
 #define GB_SVC_UNIPRO_HIBERNATE_MODE           0x11
 #define GB_SVC_UNIPRO_OFF_MODE                 0x12
 
+#define GB_SVC_SMALL_AMPLITUDE          0x01
+#define GB_SVC_LARGE_AMPLITUDE          0x02
+
+#define GB_SVC_NO_DE_EMPHASIS           0x00
+#define GB_SVC_SMALL_DE_EMPHASIS        0x01
+#define GB_SVC_LARGE_DE_EMPHASIS        0x02
+
 #define GB_SVC_PWRM_RXTERMINATION              0x01
 #define GB_SVC_PWRM_TXTERMINATION              0x02
 #define GB_SVC_PWRM_LINE_RESET                 0x04
@@ -937,21 +1127,42 @@ struct gb_svc_timesync_authoritative_response {
 #define GB_SVC_UNIPRO_HS_SERIES_A              0x01
 #define GB_SVC_UNIPRO_HS_SERIES_B              0x02
 
+#define GB_SVC_SETPWRM_PWR_OK           0x00
+#define GB_SVC_SETPWRM_PWR_LOCAL        0x01
+#define GB_SVC_SETPWRM_PWR_REMOTE       0x02
+#define GB_SVC_SETPWRM_PWR_BUSY         0x03
+#define GB_SVC_SETPWRM_PWR_ERROR_CAP    0x04
+#define GB_SVC_SETPWRM_PWR_FATAL_ERROR  0x05
+
+struct gb_svc_l2_timer_cfg {
+       __le16 tsb_fc0_protection_timeout;
+       __le16 tsb_tc0_replay_timeout;
+       __le16 tsb_afc0_req_timeout;
+       __le16 tsb_fc1_protection_timeout;
+       __le16 tsb_tc1_replay_timeout;
+       __le16 tsb_afc1_req_timeout;
+       __le16 reserved_for_tc2[3];
+       __le16 reserved_for_tc3[3];
+} __packed;
+
 struct gb_svc_intf_set_pwrm_request {
        __u8    intf_id;
        __u8    hs_series;
        __u8    tx_mode;
        __u8    tx_gear;
        __u8    tx_nlanes;
+       __u8    tx_amplitude;
+       __u8    tx_hs_equalizer;
        __u8    rx_mode;
        __u8    rx_gear;
        __u8    rx_nlanes;
        __u8    flags;
        __le32  quirks;
+       struct gb_svc_l2_timer_cfg local_l2timerdata, remote_l2timerdata;
 } __packed;
 
 struct gb_svc_intf_set_pwrm_response {
-       __le16  result_code;
+       __u8    result_code;
 } __packed;
 
 struct gb_svc_key_event_request {
@@ -963,11 +1174,100 @@ struct gb_svc_key_event_request {
 #define GB_SVC_KEY_PRESSED     0x01
 } __packed;
 
-/* RAW */
+#define GB_SVC_PWRMON_MAX_RAIL_COUNT           254
+
+struct gb_svc_pwrmon_rail_count_get_response {
+       __u8    rail_count;
+} __packed;
+
+#define GB_SVC_PWRMON_RAIL_NAME_BUFSIZE                32
+
+struct gb_svc_pwrmon_rail_names_get_response {
+       __u8    status;
+       __u8    name[0][GB_SVC_PWRMON_RAIL_NAME_BUFSIZE];
+} __packed;
+
+#define GB_SVC_PWRMON_TYPE_CURR                        0x01
+#define GB_SVC_PWRMON_TYPE_VOL                 0x02
+#define GB_SVC_PWRMON_TYPE_PWR                 0x03
+
+#define GB_SVC_PWRMON_GET_SAMPLE_OK            0x00
+#define GB_SVC_PWRMON_GET_SAMPLE_INVAL         0x01
+#define GB_SVC_PWRMON_GET_SAMPLE_NOSUPP                0x02
+#define GB_SVC_PWRMON_GET_SAMPLE_HWERR         0x03
+
+struct gb_svc_pwrmon_sample_get_request {
+       __u8    rail_id;
+       __u8    measurement_type;
+} __packed;
+
+struct gb_svc_pwrmon_sample_get_response {
+       __u8    result;
+       __le32  measurement;
+} __packed;
+
+struct gb_svc_pwrmon_intf_sample_get_request {
+       __u8    intf_id;
+       __u8    measurement_type;
+} __packed;
+
+struct gb_svc_pwrmon_intf_sample_get_response {
+       __u8    result;
+       __le32  measurement;
+} __packed;
+
+#define GB_SVC_MODULE_INSERTED_FLAG_NO_PRIMARY 0x0001
 
-/* Version of the Greybus raw protocol we support */
-#define        GB_RAW_VERSION_MAJOR                    0x00
-#define        GB_RAW_VERSION_MINOR                    0x01
+struct gb_svc_module_inserted_request {
+       __u8    primary_intf_id;
+       __u8    intf_count;
+       __le16  flags;
+} __packed;
+/* module_inserted response has no payload */
+
+struct gb_svc_module_removed_request {
+       __u8    primary_intf_id;
+} __packed;
+/* module_removed response has no payload */
+
+struct gb_svc_intf_activate_request {
+       __u8    intf_id;
+} __packed;
+
+#define GB_SVC_INTF_TYPE_UNKNOWN               0x00
+#define GB_SVC_INTF_TYPE_DUMMY                 0x01
+#define GB_SVC_INTF_TYPE_UNIPRO                        0x02
+#define GB_SVC_INTF_TYPE_GREYBUS               0x03
+
+struct gb_svc_intf_activate_response {
+       __u8    status;
+       __u8    intf_type;
+} __packed;
+
+#define GB_SVC_INTF_MAILBOX_NONE               0x00
+#define GB_SVC_INTF_MAILBOX_AP                 0x01
+#define GB_SVC_INTF_MAILBOX_GREYBUS            0x02
+
+struct gb_svc_intf_mailbox_event_request {
+       __u8    intf_id;
+       __le16  result_code;
+       __le32  mailbox;
+} __packed;
+/* intf_mailbox_event response has no payload */
+
+struct gb_svc_conn_quiescing_request {
+       __u8    intf1_id;
+       __le16  cport1_id;
+       __u8    intf2_id;
+       __le16  cport2_id;
+} __packed;
+
+struct gb_svc_conn_quiescing_response {
+       __u8    status;
+} __packed;
+
+
+/* RAW */
 
 /* Greybus raw request types */
 #define        GB_RAW_TYPE_SEND                        0x02
@@ -980,10 +1280,6 @@ struct gb_raw_send_request {
 
 /* UART */
 
-/* Version of the Greybus UART protocol we support */
-#define GB_UART_VERSION_MAJOR          0x00
-#define GB_UART_VERSION_MINOR          0x01
-
 /* Greybus UART operation types */
 #define GB_UART_TYPE_SEND_DATA                 0x02
 #define GB_UART_TYPE_RECEIVE_DATA              0x03    /* Unsolicited data */
@@ -991,6 +1287,8 @@ struct gb_raw_send_request {
 #define GB_UART_TYPE_SET_CONTROL_LINE_STATE    0x05
 #define GB_UART_TYPE_SEND_BREAK                        0x06
 #define GB_UART_TYPE_SERIAL_STATE              0x07    /* Unsolicited data */
+#define GB_UART_TYPE_RECEIVE_CREDITS           0x08
+#define GB_UART_TYPE_FLUSH_FIFOS               0x09
 
 /* Represents data from AP -> Module */
 struct gb_uart_send_data_request {
@@ -1011,6 +1309,10 @@ struct gb_uart_recv_data_request {
        __u8    data[0];
 } __packed;
 
+struct gb_uart_receive_credits_request {
+       __le16  count;
+} __packed;
+
 struct gb_uart_set_line_coding_request {
        __le32  rate;
        __u8    format;
@@ -1026,6 +1328,9 @@ struct gb_uart_set_line_coding_request {
 #define GB_SERIAL_SPACE_PARITY                 4
 
        __u8    data_bits;
+
+       __u8    flow_control;
+#define GB_SERIAL_AUTO_RTSCTS_EN               0x1
 } __packed;
 
 /* output control lines */
@@ -1049,11 +1354,13 @@ struct gb_uart_serial_state_request {
        __u8    control;
 } __packed;
 
-/* Loopback */
+struct gb_uart_serial_flush_request {
+       __u8    flags;
+#define GB_SERIAL_FLAG_FLUSH_TRANSMITTER       0x01
+#define GB_SERIAL_FLAG_FLUSH_RECEIVER          0x02
+} __packed;
 
-/* Version of the Greybus loopback protocol we support */
-#define GB_LOOPBACK_VERSION_MAJOR              0x00
-#define GB_LOOPBACK_VERSION_MINOR              0x01
+/* Loopback */
 
 /* Greybus loopback request types */
 #define GB_LOOPBACK_TYPE_PING                  0x02
@@ -1079,10 +1386,6 @@ struct gb_loopback_transfer_response {
 } __packed;
 
 /* SDIO */
-/* Version of the Greybus sdio protocol we support */
-#define GB_SDIO_VERSION_MAJOR          0x00
-#define GB_SDIO_VERSION_MINOR          0x01
-
 /* Greybus SDIO operation types */
 #define GB_SDIO_TYPE_GET_CAPABILITIES          0x02
 #define GB_SDIO_TYPE_SET_IOS                   0x03
@@ -1239,9 +1542,6 @@ struct gb_sdio_event_request {
 
 /* Camera */
 
-#define GB_CAMERA_VERSION_MAJOR                        0x00
-#define GB_CAMERA_VERSION_MINOR                        0x01
-
 /* Greybus Camera request types */
 #define GB_CAMERA_TYPE_CAPABILITIES            0x02
 #define GB_CAMERA_TYPE_CONFIGURE_STREAMS       0x03
@@ -1315,9 +1615,6 @@ struct gb_camera_metadata_request {
 
 /* Lights */
 
-#define GB_LIGHTS_VERSION_MAJOR 0x00
-#define GB_LIGHTS_VERSION_MINOR 0x01
-
 /* Greybus Lights request types */
 #define GB_LIGHTS_TYPE_GET_LIGHTS              0x02
 #define GB_LIGHTS_TYPE_GET_LIGHT_CONFIG                0x03
@@ -1489,11 +1786,6 @@ struct gb_lights_get_flash_fault_response {
 
 /* Audio */
 
-/* Version of the Greybus audio protocol we support */
-#define GB_AUDIO_VERSION_MAJOR                 0x00
-#define GB_AUDIO_VERSION_MINOR                 0x01
-
-#define GB_AUDIO_TYPE_PROTOCOL_VERSION         0x01
 #define GB_AUDIO_TYPE_GET_TOPOLOGY_SIZE                0x02
 #define GB_AUDIO_TYPE_GET_TOPOLOGY             0x03
 #define GB_AUDIO_TYPE_GET_CONTROL              0x04
@@ -1834,7 +2126,7 @@ struct gb_audio_deactivate_rx_request {
 
 struct gb_audio_jack_event_request {
        __u8    widget_id;
-       __u8    widget_type;
+       __u8    jack_attribute;
        __u8    event;
 } __packed;
 
@@ -1854,5 +2146,19 @@ struct gb_audio_send_data_request {
        __u8    data[0];
 } __packed;
 
+
+/* Log */
+
+/* operations */
+#define GB_LOG_TYPE_SEND_LOG   0x02
+
+/* length */
+#define GB_LOG_MAX_LEN         1024
+
+struct gb_log_send_log_request {
+       __le16  len;
+       __u8    msg[0];
+} __packed;
+
 #endif /* __GREYBUS_PROTOCOLS_H */