2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
7 * Copyright(c) 2014 - 2015 Google Inc. All rights reserved.
8 * Copyright(c) 2014 - 2015 Linaro Ltd. All rights reserved.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License version 2 for more details.
21 * Copyright(c) 2014 - 2015 Google Inc. All rights reserved.
22 * Copyright(c) 2014 - 2015 Linaro Ltd. All rights reserved.
24 * Redistribution and use in source and binary forms, with or without
25 * modification, are permitted provided that the following conditions
28 * * Redistributions of source code must retain the above copyright
29 * notice, this list of conditions and the following disclaimer.
30 * * Redistributions in binary form must reproduce the above copyright
31 * notice, this list of conditions and the following disclaimer in
32 * the documentation and/or other materials provided with the
34 * * Neither the name of Google Inc. or Linaro Ltd. nor the names of
35 * its contributors may be used to endorse or promote products
36 * derived from this software without specific prior written
39 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
40 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
41 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
42 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. OR
43 * LINARO LTD. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
45 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
46 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
47 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
48 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
49 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 #ifndef __GREYBUS_PROTOCOLS_H
53 #define __GREYBUS_PROTOCOLS_H
55 /* Fixed IDs for control/svc protocols */
57 /* Device ID of SVC and AP */
58 #define GB_DEVICE_ID_SVC 0
59 #define GB_DEVICE_ID_AP 1
60 #define GB_DEVICE_ID_MODULES_START 2
63 * Bundle/cport for control/svc cport: The same bundle/cport is shared by both
64 * CONTROL and SVC protocols for communication between AP and SVC.
66 #define GB_SVC_BUNDLE_ID 0
67 #define GB_SVC_CPORT_ID 2
68 #define GB_CONTROL_BUNDLE_ID 0
69 #define GB_CONTROL_CPORT_ID 2
72 /* Control Protocol */
75 /* version request has no payload */
76 struct gb_protocol_version_response {
81 /* Control Protocol */
83 /* Version of the Greybus control protocol we support */
84 #define GB_CONTROL_VERSION_MAJOR 0x00
85 #define GB_CONTROL_VERSION_MINOR 0x01
87 /* Greybus control request types */
88 #define GB_CONTROL_TYPE_INVALID 0x00
89 #define GB_CONTROL_TYPE_PROTOCOL_VERSION 0x01
90 #define GB_CONTROL_TYPE_PROBE_AP 0x02
91 #define GB_CONTROL_TYPE_GET_MANIFEST_SIZE 0x03
92 #define GB_CONTROL_TYPE_GET_MANIFEST 0x04
93 #define GB_CONTROL_TYPE_CONNECTED 0x05
94 #define GB_CONTROL_TYPE_DISCONNECTED 0x06
96 /* Control protocol manifest get size request has no payload*/
97 struct gb_control_get_manifest_size_response {
101 /* Control protocol manifest get request has no payload */
102 struct gb_control_get_manifest_response {
106 /* Control protocol [dis]connected request */
107 struct gb_control_connected_request {
111 struct gb_control_disconnected_request {
114 /* Control protocol [dis]connected response has no payload */
118 /* Version of the Greybus i2c protocol we support */
119 #define GB_I2C_VERSION_MAJOR 0x00
120 #define GB_I2C_VERSION_MINOR 0x01
122 /* Greybus i2c request types */
123 #define GB_I2C_TYPE_INVALID 0x00
124 #define GB_I2C_TYPE_PROTOCOL_VERSION 0x01
125 #define GB_I2C_TYPE_FUNCTIONALITY 0x02
126 #define GB_I2C_TYPE_TIMEOUT 0x03
127 #define GB_I2C_TYPE_RETRIES 0x04
128 #define GB_I2C_TYPE_TRANSFER 0x05
130 #define GB_I2C_RETRIES_DEFAULT 3
131 #define GB_I2C_TIMEOUT_DEFAULT 1000 /* milliseconds */
133 /* functionality request has no payload */
134 struct gb_i2c_functionality_response {
135 __le32 functionality;
138 struct gb_i2c_timeout_request {
141 /* timeout response has no payload */
143 struct gb_i2c_retries_request {
146 /* retries response has no payload */
149 * Outgoing data immediately follows the op count and ops array.
150 * The data for each write (master -> slave) op in the array is sent
151 * in order, with no (e.g. pad) bytes separating them.
153 * Short reads cause the entire transfer request to fail So response
154 * payload consists only of bytes read, and the number of bytes is
155 * exactly what was specified in the corresponding op. Like
156 * outgoing data, the incoming data is in order and contiguous.
158 struct gb_i2c_transfer_op {
164 struct gb_i2c_transfer_request {
166 struct gb_i2c_transfer_op ops[0]; /* op_count of these */
168 struct gb_i2c_transfer_response {
169 __u8 data[0]; /* inbound data */
175 /* Version of the Greybus GPIO protocol we support */
176 #define GB_GPIO_VERSION_MAJOR 0x00
177 #define GB_GPIO_VERSION_MINOR 0x01
179 /* Greybus GPIO request types */
180 #define GB_GPIO_TYPE_INVALID 0x00
181 #define GB_GPIO_TYPE_PROTOCOL_VERSION 0x01
182 #define GB_GPIO_TYPE_LINE_COUNT 0x02
183 #define GB_GPIO_TYPE_ACTIVATE 0x03
184 #define GB_GPIO_TYPE_DEACTIVATE 0x04
185 #define GB_GPIO_TYPE_GET_DIRECTION 0x05
186 #define GB_GPIO_TYPE_DIRECTION_IN 0x06
187 #define GB_GPIO_TYPE_DIRECTION_OUT 0x07
188 #define GB_GPIO_TYPE_GET_VALUE 0x08
189 #define GB_GPIO_TYPE_SET_VALUE 0x09
190 #define GB_GPIO_TYPE_SET_DEBOUNCE 0x0a
191 #define GB_GPIO_TYPE_IRQ_TYPE 0x0b
192 #define GB_GPIO_TYPE_IRQ_MASK 0x0c
193 #define GB_GPIO_TYPE_IRQ_UNMASK 0x0d
194 #define GB_GPIO_TYPE_IRQ_EVENT 0x0e
196 #define GB_GPIO_IRQ_TYPE_NONE 0x00
197 #define GB_GPIO_IRQ_TYPE_EDGE_RISING 0x01
198 #define GB_GPIO_IRQ_TYPE_EDGE_FALLING 0x02
199 #define GB_GPIO_IRQ_TYPE_EDGE_BOTH 0x03
200 #define GB_GPIO_IRQ_TYPE_LEVEL_HIGH 0x04
201 #define GB_GPIO_IRQ_TYPE_LEVEL_LOW 0x08
203 /* line count request has no payload */
204 struct gb_gpio_line_count_response {
208 struct gb_gpio_activate_request {
211 /* activate response has no payload */
213 struct gb_gpio_deactivate_request {
216 /* deactivate response has no payload */
218 struct gb_gpio_get_direction_request {
221 struct gb_gpio_get_direction_response {
225 struct gb_gpio_direction_in_request {
228 /* direction in response has no payload */
230 struct gb_gpio_direction_out_request {
234 /* direction out response has no payload */
236 struct gb_gpio_get_value_request {
239 struct gb_gpio_get_value_response {
243 struct gb_gpio_set_value_request {
247 /* set value response has no payload */
249 struct gb_gpio_set_debounce_request {
251 __le16 usec __packed;
253 /* debounce response has no payload */
255 struct gb_gpio_irq_type_request {
259 /* irq type response has no payload */
261 struct gb_gpio_irq_mask_request {
264 /* irq mask response has no payload */
266 struct gb_gpio_irq_unmask_request {
269 /* irq unmask response has no payload */
271 /* irq event requests originate on another module and are handled on the AP */
272 struct gb_gpio_irq_event_request {
275 /* irq event has no response */
280 /* Version of the Greybus PWM protocol we support */
281 #define GB_PWM_VERSION_MAJOR 0x00
282 #define GB_PWM_VERSION_MINOR 0x01
284 /* Greybus PWM operation types */
285 #define GB_PWM_TYPE_INVALID 0x00
286 #define GB_PWM_TYPE_PROTOCOL_VERSION 0x01
287 #define GB_PWM_TYPE_PWM_COUNT 0x02
288 #define GB_PWM_TYPE_ACTIVATE 0x03
289 #define GB_PWM_TYPE_DEACTIVATE 0x04
290 #define GB_PWM_TYPE_CONFIG 0x05
291 #define GB_PWM_TYPE_POLARITY 0x06
292 #define GB_PWM_TYPE_ENABLE 0x07
293 #define GB_PWM_TYPE_DISABLE 0x08
295 /* pwm count request has no payload */
296 struct gb_pwm_count_response {
300 struct gb_pwm_activate_request {
304 struct gb_pwm_deactivate_request {
308 struct gb_pwm_config_request {
310 __le32 duty __packed;
311 __le32 period __packed;
314 struct gb_pwm_polarity_request {
319 struct gb_pwm_enable_request {
323 struct gb_pwm_disable_request {
329 #define GB_I2S_MGMT_TYPE_PROTOCOL_VERSION 0x01
330 #define GB_I2S_MGMT_TYPE_GET_SUPPORTED_CONFIGURATIONS 0x02
331 #define GB_I2S_MGMT_TYPE_SET_CONFIGURATION 0x03
332 #define GB_I2S_MGMT_TYPE_SET_SAMPLES_PER_MESSAGE 0x04
333 #define GB_I2S_MGMT_TYPE_GET_PROCESSING_DELAY 0x05
334 #define GB_I2S_MGMT_TYPE_SET_START_DELAY 0x06
335 #define GB_I2S_MGMT_TYPE_ACTIVATE_CPORT 0x07
336 #define GB_I2S_MGMT_TYPE_DEACTIVATE_CPORT 0x08
337 #define GB_I2S_MGMT_TYPE_REPORT_EVENT 0x09
339 #define GB_I2S_MGMT_BYTE_ORDER_NA BIT(0)
340 #define GB_I2S_MGMT_BYTE_ORDER_BE BIT(1)
341 #define GB_I2S_MGMT_BYTE_ORDER_LE BIT(2)
343 #define GB_I2S_MGMT_SPATIAL_LOCATION_FL BIT(0)
344 #define GB_I2S_MGMT_SPATIAL_LOCATION_FR BIT(1)
345 #define GB_I2S_MGMT_SPATIAL_LOCATION_FC BIT(2)
346 #define GB_I2S_MGMT_SPATIAL_LOCATION_LFE BIT(3)
347 #define GB_I2S_MGMT_SPATIAL_LOCATION_BL BIT(4)
348 #define GB_I2S_MGMT_SPATIAL_LOCATION_BR BIT(5)
349 #define GB_I2S_MGMT_SPATIAL_LOCATION_FLC BIT(6)
350 #define GB_I2S_MGMT_SPATIAL_LOCATION_FRC BIT(7)
351 #define GB_I2S_MGMT_SPATIAL_LOCATION_C BIT(8) /* BC in USB */
352 #define GB_I2S_MGMT_SPATIAL_LOCATION_SL BIT(9)
353 #define GB_I2S_MGMT_SPATIAL_LOCATION_SR BIT(10)
354 #define GB_I2S_MGMT_SPATIAL_LOCATION_TC BIT(11)
355 #define GB_I2S_MGMT_SPATIAL_LOCATION_TFL BIT(12)
356 #define GB_I2S_MGMT_SPATIAL_LOCATION_TFC BIT(13)
357 #define GB_I2S_MGMT_SPATIAL_LOCATION_TFR BIT(14)
358 #define GB_I2S_MGMT_SPATIAL_LOCATION_TBL BIT(15)
359 #define GB_I2S_MGMT_SPATIAL_LOCATION_TBC BIT(16)
360 #define GB_I2S_MGMT_SPATIAL_LOCATION_TBR BIT(17)
361 #define GB_I2S_MGMT_SPATIAL_LOCATION_TFLC BIT(18)
362 #define GB_I2S_MGMT_SPATIAL_LOCATION_TFRC BIT(19)
363 #define GB_I2S_MGMT_SPATIAL_LOCATION_LLFE BIT(20)
364 #define GB_I2S_MGMT_SPATIAL_LOCATION_RLFE BIT(21)
365 #define GB_I2S_MGMT_SPATIAL_LOCATION_TSL BIT(22)
366 #define GB_I2S_MGMT_SPATIAL_LOCATION_TSR BIT(23)
367 #define GB_I2S_MGMT_SPATIAL_LOCATION_BC BIT(24)
368 #define GB_I2S_MGMT_SPATIAL_LOCATION_BLC BIT(25)
369 #define GB_I2S_MGMT_SPATIAL_LOCATION_BRC BIT(26)
370 #define GB_I2S_MGMT_SPATIAL_LOCATION_RD BIT(31)
372 #define GB_I2S_MGMT_PROTOCOL_PCM BIT(0)
373 #define GB_I2S_MGMT_PROTOCOL_I2S BIT(1)
374 #define GB_I2S_MGMT_PROTOCOL_LR_STEREO BIT(2)
376 #define GB_I2S_MGMT_ROLE_MASTER BIT(0)
377 #define GB_I2S_MGMT_ROLE_SLAVE BIT(1)
379 #define GB_I2S_MGMT_POLARITY_NORMAL BIT(0)
380 #define GB_I2S_MGMT_POLARITY_REVERSED BIT(1)
382 #define GB_I2S_MGMT_EDGE_RISING BIT(0)
383 #define GB_I2S_MGMT_EDGE_FALLING BIT(1)
385 #define GB_I2S_MGMT_EVENT_UNSPECIFIED 0x1
386 #define GB_I2S_MGMT_EVENT_HALT 0x2
387 #define GB_I2S_MGMT_EVENT_INTERNAL_ERROR 0x3
388 #define GB_I2S_MGMT_EVENT_PROTOCOL_ERROR 0x4
389 #define GB_I2S_MGMT_EVENT_FAILURE 0x5
390 #define GB_I2S_MGMT_EVENT_OUT_OF_SEQUENCE 0x6
391 #define GB_I2S_MGMT_EVENT_UNDERRUN 0x7
392 #define GB_I2S_MGMT_EVENT_OVERRUN 0x8
393 #define GB_I2S_MGMT_EVENT_CLOCKING 0x9
394 #define GB_I2S_MGMT_EVENT_DATA_LEN 0xa
396 struct gb_i2s_mgmt_configuration {
397 __le32 sample_frequency;
399 __u8 bytes_per_channel;
402 __le32 spatial_locations;
407 __u8 ll_wclk_polarity;
408 __u8 ll_wclk_change_edge;
409 __u8 ll_wclk_tx_edge;
410 __u8 ll_wclk_rx_edge;
414 /* get supported configurations request has no payload */
415 struct gb_i2s_mgmt_get_supported_configurations_response {
418 struct gb_i2s_mgmt_configuration config[0];
421 struct gb_i2s_mgmt_set_configuration_request {
422 struct gb_i2s_mgmt_configuration config;
424 /* set configuration response has no payload */
426 struct gb_i2s_mgmt_set_samples_per_message_request {
427 __le16 samples_per_message;
429 /* set samples per message response has no payload */
431 /* get processing request delay has no payload */
432 struct gb_i2s_mgmt_get_processing_delay_response {
436 struct gb_i2s_mgmt_set_start_delay_request {
439 /* set start delay response has no payload */
441 struct gb_i2s_mgmt_activate_cport_request {
444 /* activate cport response has no payload */
446 struct gb_i2s_mgmt_deactivate_cport_request {
449 /* deactivate cport response has no payload */
451 struct gb_i2s_mgmt_report_event_request {
454 /* report event response has no payload */
456 #define GB_I2S_DATA_TYPE_PROTOCOL_VERSION 0x01
457 #define GB_I2S_DATA_TYPE_SEND_DATA 0x02
459 struct gb_i2s_send_data_request {
460 __le32 sample_number;
464 /* send data has no response at all */
469 /* Version of the Greybus spi protocol we support */
470 #define GB_SPI_VERSION_MAJOR 0x00
471 #define GB_SPI_VERSION_MINOR 0x01
473 /* Should match up with modes in linux/spi/spi.h */
474 #define GB_SPI_MODE_CPHA 0x01 /* clock phase */
475 #define GB_SPI_MODE_CPOL 0x02 /* clock polarity */
476 #define GB_SPI_MODE_MODE_0 (0|0) /* (original MicroWire) */
477 #define GB_SPI_MODE_MODE_1 (0|GB_SPI_MODE_CPHA)
478 #define GB_SPI_MODE_MODE_2 (GB_SPI_MODE_CPOL|0)
479 #define GB_SPI_MODE_MODE_3 (GB_SPI_MODE_CPOL|GB_SPI_MODE_CPHA)
480 #define GB_SPI_MODE_CS_HIGH 0x04 /* chipselect active high? */
481 #define GB_SPI_MODE_LSB_FIRST 0x08 /* per-word bits-on-wire */
482 #define GB_SPI_MODE_3WIRE 0x10 /* SI/SO signals shared */
483 #define GB_SPI_MODE_LOOP 0x20 /* loopback mode */
484 #define GB_SPI_MODE_NO_CS 0x40 /* 1 dev/bus, no chipselect */
485 #define GB_SPI_MODE_READY 0x80 /* slave pulls low to pause */
487 /* Should match up with flags in linux/spi/spi.h */
488 #define GB_SPI_FLAG_HALF_DUPLEX BIT(0) /* can't do full duplex */
489 #define GB_SPI_FLAG_NO_RX BIT(1) /* can't do buffer read */
490 #define GB_SPI_FLAG_NO_TX BIT(2) /* can't do buffer write */
492 /* Greybus spi operation types */
493 #define GB_SPI_TYPE_INVALID 0x00
494 #define GB_SPI_TYPE_PROTOCOL_VERSION 0x01
495 #define GB_SPI_TYPE_MODE 0x02
496 #define GB_SPI_TYPE_FLAGS 0x03
497 #define GB_SPI_TYPE_BITS_PER_WORD_MASK 0x04
498 #define GB_SPI_TYPE_NUM_CHIPSELECT 0x05
499 #define GB_SPI_TYPE_TRANSFER 0x06
501 /* mode request has no payload */
502 struct gb_spi_mode_response {
506 /* flags request has no payload */
507 struct gb_spi_flags_response {
511 /* bits-per-word request has no payload */
512 struct gb_spi_bpw_response {
513 __le32 bits_per_word_mask;
516 /* num-chipselects request has no payload */
517 struct gb_spi_chipselect_response {
518 __le16 num_chipselect;
522 * struct gb_spi_transfer - a read/write buffer pair
523 * @speed_hz: Select a speed other than the device default for this transfer. If
524 * 0 the default (from @spi_device) is used.
525 * @len: size of rx and tx buffers (in bytes)
526 * @delay_usecs: microseconds to delay after this transfer before (optionally)
527 * changing the chipselect status, then starting the next transfer or
528 * completing this spi_message.
529 * @cs_change: affects chipselect after this transfer completes
530 * @bits_per_word: select a bits_per_word other than the device default for this
531 * transfer. If 0 the default (from @spi_device) is used.
533 struct gb_spi_transfer {
541 struct gb_spi_transfer_request {
542 __u8 chip_select; /* of the spi device */
543 __u8 mode; /* of the spi device */
545 struct gb_spi_transfer transfers[0]; /* trnasfer_count of these */
548 struct gb_spi_transfer_response {
549 __u8 data[0]; /* inbound data */
552 /* Version of the Greybus SVC protocol we support */
553 #define GB_SVC_VERSION_MAJOR 0x00
554 #define GB_SVC_VERSION_MINOR 0x01
556 /* Greybus SVC request types */
557 #define GB_SVC_TYPE_INVALID 0x00
558 #define GB_SVC_TYPE_PROTOCOL_VERSION 0x01
559 #define GB_SVC_TYPE_SVC_HELLO 0x02
560 #define GB_SVC_TYPE_INTF_DEVICE_ID 0x03
561 #define GB_SVC_TYPE_INTF_HOTPLUG 0x04
562 #define GB_SVC_TYPE_INTF_HOT_UNPLUG 0x05
563 #define GB_SVC_TYPE_INTF_RESET 0x06
564 #define GB_SVC_TYPE_CONN_CREATE 0x07
565 #define GB_SVC_TYPE_CONN_DESTROY 0x08
567 /* SVC version request/response have same payload as gb_protocol_version_response */
569 /* SVC protocol hello request */
570 struct gb_svc_hello_request {
574 /* hello response has no payload */
576 struct gb_svc_intf_device_id_request {
580 /* device id response has no payload */
582 struct gb_svc_intf_hotplug_request {
585 __le32 unipro_mfg_id;
586 __le32 unipro_prod_id;
591 /* hotplug response has no payload */
593 struct gb_svc_intf_hot_unplug_request {
596 /* hot unplug response has no payload */
598 struct gb_svc_intf_reset_request {
601 /* interface reset response has no payload */
603 struct gb_svc_conn_create_request {
609 /* connection create response has no payload */
611 struct gb_svc_conn_destroy_request {
617 /* connection destroy response has no payload */
621 /* Version of the Greybus UART protocol we support */
622 #define GB_UART_VERSION_MAJOR 0x00
623 #define GB_UART_VERSION_MINOR 0x01
625 /* Greybus UART operation types */
626 #define GB_UART_TYPE_INVALID 0x00
627 #define GB_UART_TYPE_PROTOCOL_VERSION 0x01
628 #define GB_UART_TYPE_SEND_DATA 0x02
629 #define GB_UART_TYPE_RECEIVE_DATA 0x03 /* Unsolicited data */
630 #define GB_UART_TYPE_SET_LINE_CODING 0x04
631 #define GB_UART_TYPE_SET_CONTROL_LINE_STATE 0x05
632 #define GB_UART_TYPE_SEND_BREAK 0x06
633 #define GB_UART_TYPE_SERIAL_STATE 0x07 /* Unsolicited data */
635 /* Represents data from AP -> Module */
636 struct gb_uart_send_data_request {
641 /* recv-data-request flags */
642 #define GB_UART_RECV_FLAG_FRAMING 0x01 /* Framing error */
643 #define GB_UART_RECV_FLAG_PARITY 0x02 /* Parity error */
644 #define GB_UART_RECV_FLAG_OVERRUN 0x04 /* Overrun error */
645 #define GB_UART_RECV_FLAG_BREAK 0x08 /* Break */
647 /* Represents data from Module -> AP */
648 struct gb_uart_recv_data_request {
654 struct gb_uart_set_line_coding_request {
657 #define GB_SERIAL_1_STOP_BITS 0
658 #define GB_SERIAL_1_5_STOP_BITS 1
659 #define GB_SERIAL_2_STOP_BITS 2
662 #define GB_SERIAL_NO_PARITY 0
663 #define GB_SERIAL_ODD_PARITY 1
664 #define GB_SERIAL_EVEN_PARITY 2
665 #define GB_SERIAL_MARK_PARITY 3
666 #define GB_SERIAL_SPACE_PARITY 4
671 /* output control lines */
672 #define GB_UART_CTRL_DTR 0x01
673 #define GB_UART_CTRL_RTS 0x02
675 struct gb_uart_set_control_line_state_request {
679 struct gb_uart_set_break_request {
683 /* input control lines and line errors */
684 #define GB_UART_CTRL_DCD 0x01
685 #define GB_UART_CTRL_DSR 0x02
686 #define GB_UART_CTRL_RI 0x04
688 struct gb_uart_serial_state_request {
694 /* Version of the Greybus loopback protocol we support */
695 #define GB_LOOPBACK_VERSION_MAJOR 0x00
696 #define GB_LOOPBACK_VERSION_MINOR 0x01
698 /* Greybus loopback request types */
699 #define GB_LOOPBACK_TYPE_INVALID 0x00
700 #define GB_LOOPBACK_TYPE_PROTOCOL_VERSION 0x01
701 #define GB_LOOPBACK_TYPE_PING 0x02
702 #define GB_LOOPBACK_TYPE_TRANSFER 0x03
703 #define GB_LOOPBACK_TYPE_SINK 0x04
705 struct gb_loopback_transfer_request {
710 struct gb_loopback_transfer_response {
715 /* Version of the Greybus sdio protocol we support */
716 #define GB_SDIO_VERSION_MAJOR 0x00
717 #define GB_SDIO_VERSION_MINOR 0x01
719 /* Greybus SDIO operation types */
720 #define GB_SDIO_TYPE_INVALID 0x00
721 #define GB_SDIO_TYPE_PROTOCOL_VERSION 0x01
722 #define GB_SDIO_TYPE_GET_CAPABILITIES 0x02
723 #define GB_SDIO_TYPE_SET_IOS 0x03
724 #define GB_SDIO_TYPE_COMMAND 0x04
725 #define GB_SDIO_TYPE_TRANSFER 0x05
726 #define GB_SDIO_TYPE_EVENT 0x06
728 /* get caps response: request has no payload */
729 struct gb_sdio_get_caps_response {
731 #define GB_SDIO_CAP_NONREMOVABLE 0x00000001
732 #define GB_SDIO_CAP_4_BIT_DATA 0x00000002
733 #define GB_SDIO_CAP_8_BIT_DATA 0x00000004
734 #define GB_SDIO_CAP_MMC_HS 0x00000008
735 #define GB_SDIO_CAP_SD_HS 0x00000010
736 #define GB_SDIO_CAP_ERASE 0x00000020
737 #define GB_SDIO_CAP_1_2V_DDR 0x00000040
738 #define GB_SDIO_CAP_1_8V_DDR 0x00000080
739 #define GB_SDIO_CAP_POWER_OFF_CARD 0x00000100
740 #define GB_SDIO_CAP_UHS_SDR12 0x00000200
741 #define GB_SDIO_CAP_UHS_SDR25 0x00000400
742 #define GB_SDIO_CAP_UHS_SDR50 0x00000800
743 #define GB_SDIO_CAP_UHS_SDR104 0x00001000
744 #define GB_SDIO_CAP_UHS_DDR50 0x00002000
745 #define GB_SDIO_CAP_DRIVER_TYPE_A 0x00004000
746 #define GB_SDIO_CAP_DRIVER_TYPE_C 0x00008000
747 #define GB_SDIO_CAP_DRIVER_TYPE_D 0x00010000
748 #define GB_SDIO_CAP_HS200_1_2V 0x00020000
749 #define GB_SDIO_CAP_HS200_1_8V 0x00040000
750 #define GB_SDIO_CAP_HS400_1_2V 0x00080000
751 #define GB_SDIO_CAP_HS400_1_8V 0x00100000
753 /* see possible values below at vdd */
755 __le16 max_blk_count;
759 /* set ios request: response has no payload */
760 struct gb_sdio_set_ios_request {
763 #define GB_SDIO_VDD_165_195 0x00000001
764 #define GB_SDIO_VDD_20_21 0x00000002
765 #define GB_SDIO_VDD_21_22 0x00000004
766 #define GB_SDIO_VDD_22_23 0x00000008
767 #define GB_SDIO_VDD_23_24 0x00000010
768 #define GB_SDIO_VDD_24_25 0x00000020
769 #define GB_SDIO_VDD_25_26 0x00000040
770 #define GB_SDIO_VDD_26_27 0x00000080
771 #define GB_SDIO_VDD_27_28 0x00000100
772 #define GB_SDIO_VDD_28_29 0x00000200
773 #define GB_SDIO_VDD_29_30 0x00000400
774 #define GB_SDIO_VDD_30_31 0x00000800
775 #define GB_SDIO_VDD_31_32 0x00001000
776 #define GB_SDIO_VDD_32_33 0x00002000
777 #define GB_SDIO_VDD_33_34 0x00004000
778 #define GB_SDIO_VDD_34_35 0x00008000
779 #define GB_SDIO_VDD_35_36 0x00010000
782 #define GB_SDIO_BUSMODE_OPENDRAIN 0x00
783 #define GB_SDIO_BUSMODE_PUSHPULL 0x01
786 #define GB_SDIO_POWER_OFF 0x00
787 #define GB_SDIO_POWER_UP 0x01
788 #define GB_SDIO_POWER_ON 0x02
789 #define GB_SDIO_POWER_UNDEFINED 0x03
792 #define GB_SDIO_BUS_WIDTH_1 0x00
793 #define GB_SDIO_BUS_WIDTH_4 0x02
794 #define GB_SDIO_BUS_WIDTH_8 0x03
797 #define GB_SDIO_TIMING_LEGACY 0x00
798 #define GB_SDIO_TIMING_MMC_HS 0x01
799 #define GB_SDIO_TIMING_SD_HS 0x02
800 #define GB_SDIO_TIMING_UHS_SDR12 0x03
801 #define GB_SDIO_TIMING_UHS_SDR25 0x04
802 #define GB_SDIO_TIMING_UHS_SDR50 0x05
803 #define GB_SDIO_TIMING_UHS_SDR104 0x06
804 #define GB_SDIO_TIMING_UHS_DDR50 0x07
805 #define GB_SDIO_TIMING_MMC_DDR52 0x08
806 #define GB_SDIO_TIMING_MMC_HS200 0x09
807 #define GB_SDIO_TIMING_MMC_HS400 0x0A
810 #define GB_SDIO_SIGNAL_VOLTAGE_330 0x00
811 #define GB_SDIO_SIGNAL_VOLTAGE_180 0x01
812 #define GB_SDIO_SIGNAL_VOLTAGE_120 0x02
815 #define GB_SDIO_SET_DRIVER_TYPE_B 0x00
816 #define GB_SDIO_SET_DRIVER_TYPE_A 0x01
817 #define GB_SDIO_SET_DRIVER_TYPE_C 0x02
818 #define GB_SDIO_SET_DRIVER_TYPE_D 0x03
821 /* command request */
822 struct gb_sdio_command_request {
825 #define GB_SDIO_RSP_NONE 0x00
826 #define GB_SDIO_RSP_PRESENT 0x01
827 #define GB_SDIO_RSP_136 0x02
828 #define GB_SDIO_RSP_CRC 0x04
829 #define GB_SDIO_RSP_BUSY 0x08
830 #define GB_SDIO_RSP_OPCODE 0x10
833 #define GB_SDIO_CMD_AC 0x00
834 #define GB_SDIO_CMD_ADTC 0x01
835 #define GB_SDIO_CMD_BCR 0x02
836 #define GB_SDIO_CMD_BC 0x03
841 struct gb_sdio_command_response {
845 /* transfer request */
846 struct gb_sdio_transfer_request {
848 #define GB_SDIO_DATA_WRITE 0x01
849 #define GB_SDIO_DATA_READ 0x02
850 #define GB_SDIO_DATA_STREAM 0x04
857 struct gb_sdio_transfer_response {
863 /* event request: generated by module and is defined as unidirectional */
864 struct gb_sdio_event_request {
866 #define GB_SDIO_CARD_INSERTED 0x01
867 #define GB_SDIO_CARD_REMOVED 0x02
868 #define GB_SDIO_WP 0x04
871 #endif /* __GREYBUS_PROTOCOLS_H */