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 /* Control Protocol */
57 /* Bundle-id and cport-id for control cport */
58 #define GB_CONTROL_BUNDLE_ID 0
59 #define GB_CONTROL_CPORT_ID 2
61 /* Version of the Greybus control protocol we support */
62 #define GB_CONTROL_VERSION_MAJOR 0x00
63 #define GB_CONTROL_VERSION_MINOR 0x01
65 /* Greybus control request types */
66 #define GB_CONTROL_TYPE_INVALID 0x00
67 #define GB_CONTROL_TYPE_PROTOCOL_VERSION 0x01
68 #define GB_CONTROL_TYPE_PROBE_AP 0x02
69 #define GB_CONTROL_TYPE_GET_MANIFEST_SIZE 0x03
70 #define GB_CONTROL_TYPE_GET_MANIFEST 0x04
71 #define GB_CONTROL_TYPE_CONNECTED 0x05
72 #define GB_CONTROL_TYPE_DISCONNECTED 0x06
74 /* Control protocol manifest get size request has no payload*/
75 struct gb_control_get_manifest_size_response {
79 /* Control protocol manifest get request has no payload */
80 struct gb_control_get_manifest_response {
84 /* Control protocol [dis]connected request */
85 struct gb_control_connected_request {
89 struct gb_control_disconnected_request {
92 /* Control protocol [dis]connected response has no payload */
96 /* Version of the Greybus i2c protocol we support */
97 #define GB_I2C_VERSION_MAJOR 0x00
98 #define GB_I2C_VERSION_MINOR 0x01
100 /* Greybus i2c request types */
101 #define GB_I2C_TYPE_INVALID 0x00
102 #define GB_I2C_TYPE_PROTOCOL_VERSION 0x01
103 #define GB_I2C_TYPE_FUNCTIONALITY 0x02
104 #define GB_I2C_TYPE_TIMEOUT 0x03
105 #define GB_I2C_TYPE_RETRIES 0x04
106 #define GB_I2C_TYPE_TRANSFER 0x05
108 #define GB_I2C_RETRIES_DEFAULT 3
109 #define GB_I2C_TIMEOUT_DEFAULT 1000 /* milliseconds */
111 /* functionality request has no payload */
112 struct gb_i2c_functionality_response {
113 __le32 functionality;
116 struct gb_i2c_timeout_request {
119 /* timeout response has no payload */
121 struct gb_i2c_retries_request {
124 /* retries response has no payload */
127 * Outgoing data immediately follows the op count and ops array.
128 * The data for each write (master -> slave) op in the array is sent
129 * in order, with no (e.g. pad) bytes separating them.
131 * Short reads cause the entire transfer request to fail So response
132 * payload consists only of bytes read, and the number of bytes is
133 * exactly what was specified in the corresponding op. Like
134 * outgoing data, the incoming data is in order and contiguous.
136 struct gb_i2c_transfer_op {
142 struct gb_i2c_transfer_request {
144 struct gb_i2c_transfer_op ops[0]; /* op_count of these */
146 struct gb_i2c_transfer_response {
147 __u8 data[0]; /* inbound data */
153 /* Version of the Greybus GPIO protocol we support */
154 #define GB_GPIO_VERSION_MAJOR 0x00
155 #define GB_GPIO_VERSION_MINOR 0x01
157 /* Greybus GPIO request types */
158 #define GB_GPIO_TYPE_INVALID 0x00
159 #define GB_GPIO_TYPE_PROTOCOL_VERSION 0x01
160 #define GB_GPIO_TYPE_LINE_COUNT 0x02
161 #define GB_GPIO_TYPE_ACTIVATE 0x03
162 #define GB_GPIO_TYPE_DEACTIVATE 0x04
163 #define GB_GPIO_TYPE_GET_DIRECTION 0x05
164 #define GB_GPIO_TYPE_DIRECTION_IN 0x06
165 #define GB_GPIO_TYPE_DIRECTION_OUT 0x07
166 #define GB_GPIO_TYPE_GET_VALUE 0x08
167 #define GB_GPIO_TYPE_SET_VALUE 0x09
168 #define GB_GPIO_TYPE_SET_DEBOUNCE 0x0a
169 #define GB_GPIO_TYPE_IRQ_TYPE 0x0b
170 #define GB_GPIO_TYPE_IRQ_MASK 0x0c
171 #define GB_GPIO_TYPE_IRQ_UNMASK 0x0d
172 #define GB_GPIO_TYPE_IRQ_EVENT 0x0e
174 #define GB_GPIO_IRQ_TYPE_NONE 0x00
175 #define GB_GPIO_IRQ_TYPE_EDGE_RISING 0x01
176 #define GB_GPIO_IRQ_TYPE_EDGE_FALLING 0x02
177 #define GB_GPIO_IRQ_TYPE_EDGE_BOTH 0x03
178 #define GB_GPIO_IRQ_TYPE_LEVEL_HIGH 0x04
179 #define GB_GPIO_IRQ_TYPE_LEVEL_LOW 0x08
181 /* line count request has no payload */
182 struct gb_gpio_line_count_response {
186 struct gb_gpio_activate_request {
189 /* activate response has no payload */
191 struct gb_gpio_deactivate_request {
194 /* deactivate response has no payload */
196 struct gb_gpio_get_direction_request {
199 struct gb_gpio_get_direction_response {
203 struct gb_gpio_direction_in_request {
206 /* direction in response has no payload */
208 struct gb_gpio_direction_out_request {
212 /* direction out response has no payload */
214 struct gb_gpio_get_value_request {
217 struct gb_gpio_get_value_response {
221 struct gb_gpio_set_value_request {
225 /* set value response has no payload */
227 struct gb_gpio_set_debounce_request {
229 __le16 usec __packed;
231 /* debounce response has no payload */
233 struct gb_gpio_irq_type_request {
237 /* irq type response has no payload */
239 struct gb_gpio_irq_mask_request {
242 /* irq mask response has no payload */
244 struct gb_gpio_irq_unmask_request {
247 /* irq unmask response has no payload */
249 /* irq event requests originate on another module and are handled on the AP */
250 struct gb_gpio_irq_event_request {
253 /* irq event has no response */
258 /* Version of the Greybus PWM protocol we support */
259 #define GB_PWM_VERSION_MAJOR 0x00
260 #define GB_PWM_VERSION_MINOR 0x01
262 /* Greybus PWM operation types */
263 #define GB_PWM_TYPE_INVALID 0x00
264 #define GB_PWM_TYPE_PROTOCOL_VERSION 0x01
265 #define GB_PWM_TYPE_PWM_COUNT 0x02
266 #define GB_PWM_TYPE_ACTIVATE 0x03
267 #define GB_PWM_TYPE_DEACTIVATE 0x04
268 #define GB_PWM_TYPE_CONFIG 0x05
269 #define GB_PWM_TYPE_POLARITY 0x06
270 #define GB_PWM_TYPE_ENABLE 0x07
271 #define GB_PWM_TYPE_DISABLE 0x08
273 /* pwm count request has no payload */
274 struct gb_pwm_count_response {
278 struct gb_pwm_activate_request {
282 struct gb_pwm_deactivate_request {
286 struct gb_pwm_config_request {
288 __le32 duty __packed;
289 __le32 period __packed;
292 struct gb_pwm_polarity_request {
297 struct gb_pwm_enable_request {
301 struct gb_pwm_disable_request {
307 #define GB_I2S_MGMT_TYPE_PROTOCOL_VERSION 0x01
308 #define GB_I2S_MGMT_TYPE_GET_SUPPORTED_CONFIGURATIONS 0x02
309 #define GB_I2S_MGMT_TYPE_SET_CONFIGURATION 0x03
310 #define GB_I2S_MGMT_TYPE_SET_SAMPLES_PER_MESSAGE 0x04
311 #define GB_I2S_MGMT_TYPE_GET_PROCESSING_DELAY 0x05
312 #define GB_I2S_MGMT_TYPE_SET_START_DELAY 0x06
313 #define GB_I2S_MGMT_TYPE_ACTIVATE_CPORT 0x07
314 #define GB_I2S_MGMT_TYPE_DEACTIVATE_CPORT 0x08
315 #define GB_I2S_MGMT_TYPE_REPORT_EVENT 0x09
317 #define GB_I2S_MGMT_BYTE_ORDER_NA BIT(0)
318 #define GB_I2S_MGMT_BYTE_ORDER_BE BIT(1)
319 #define GB_I2S_MGMT_BYTE_ORDER_LE BIT(2)
321 #define GB_I2S_MGMT_SPATIAL_LOCATION_FL BIT(0)
322 #define GB_I2S_MGMT_SPATIAL_LOCATION_FR BIT(1)
323 #define GB_I2S_MGMT_SPATIAL_LOCATION_FC BIT(2)
324 #define GB_I2S_MGMT_SPATIAL_LOCATION_LFE BIT(3)
325 #define GB_I2S_MGMT_SPATIAL_LOCATION_BL BIT(4)
326 #define GB_I2S_MGMT_SPATIAL_LOCATION_BR BIT(5)
327 #define GB_I2S_MGMT_SPATIAL_LOCATION_FLC BIT(6)
328 #define GB_I2S_MGMT_SPATIAL_LOCATION_FRC BIT(7)
329 #define GB_I2S_MGMT_SPATIAL_LOCATION_C BIT(8) /* BC in USB */
330 #define GB_I2S_MGMT_SPATIAL_LOCATION_SL BIT(9)
331 #define GB_I2S_MGMT_SPATIAL_LOCATION_SR BIT(10)
332 #define GB_I2S_MGMT_SPATIAL_LOCATION_TC BIT(11)
333 #define GB_I2S_MGMT_SPATIAL_LOCATION_TFL BIT(12)
334 #define GB_I2S_MGMT_SPATIAL_LOCATION_TFC BIT(13)
335 #define GB_I2S_MGMT_SPATIAL_LOCATION_TFR BIT(14)
336 #define GB_I2S_MGMT_SPATIAL_LOCATION_TBL BIT(15)
337 #define GB_I2S_MGMT_SPATIAL_LOCATION_TBC BIT(16)
338 #define GB_I2S_MGMT_SPATIAL_LOCATION_TBR BIT(17)
339 #define GB_I2S_MGMT_SPATIAL_LOCATION_TFLC BIT(18)
340 #define GB_I2S_MGMT_SPATIAL_LOCATION_TFRC BIT(19)
341 #define GB_I2S_MGMT_SPATIAL_LOCATION_LLFE BIT(20)
342 #define GB_I2S_MGMT_SPATIAL_LOCATION_RLFE BIT(21)
343 #define GB_I2S_MGMT_SPATIAL_LOCATION_TSL BIT(22)
344 #define GB_I2S_MGMT_SPATIAL_LOCATION_TSR BIT(23)
345 #define GB_I2S_MGMT_SPATIAL_LOCATION_BC BIT(24)
346 #define GB_I2S_MGMT_SPATIAL_LOCATION_BLC BIT(25)
347 #define GB_I2S_MGMT_SPATIAL_LOCATION_BRC BIT(26)
348 #define GB_I2S_MGMT_SPATIAL_LOCATION_RD BIT(31)
350 #define GB_I2S_MGMT_PROTOCOL_PCM BIT(0)
351 #define GB_I2S_MGMT_PROTOCOL_I2S BIT(1)
352 #define GB_I2S_MGMT_PROTOCOL_LR_STEREO BIT(2)
354 #define GB_I2S_MGMT_ROLE_MASTER BIT(0)
355 #define GB_I2S_MGMT_ROLE_SLAVE BIT(1)
357 #define GB_I2S_MGMT_POLARITY_NORMAL BIT(0)
358 #define GB_I2S_MGMT_POLARITY_REVERSED BIT(1)
360 #define GB_I2S_MGMT_EDGE_RISING BIT(0)
361 #define GB_I2S_MGMT_EDGE_FALLING BIT(1)
363 #define GB_I2S_MGMT_EVENT_UNSPECIFIED 0x1
364 #define GB_I2S_MGMT_EVENT_HALT 0x2
365 #define GB_I2S_MGMT_EVENT_INTERNAL_ERROR 0x3
366 #define GB_I2S_MGMT_EVENT_PROTOCOL_ERROR 0x4
367 #define GB_I2S_MGMT_EVENT_FAILURE 0x5
368 #define GB_I2S_MGMT_EVENT_OUT_OF_SEQUENCE 0x6
369 #define GB_I2S_MGMT_EVENT_UNDERRUN 0x7
370 #define GB_I2S_MGMT_EVENT_OVERRUN 0x8
371 #define GB_I2S_MGMT_EVENT_CLOCKING 0x9
372 #define GB_I2S_MGMT_EVENT_DATA_LEN 0xa
374 struct gb_i2s_mgmt_configuration {
375 __le32 sample_frequency;
377 __u8 bytes_per_channel;
380 __le32 spatial_locations;
385 __u8 ll_wclk_polarity;
386 __u8 ll_wclk_change_edge;
387 __u8 ll_wclk_tx_edge;
388 __u8 ll_wclk_rx_edge;
392 /* get supported configurations request has no payload */
393 struct gb_i2s_mgmt_get_supported_configurations_response {
396 struct gb_i2s_mgmt_configuration config[0];
399 struct gb_i2s_mgmt_set_configuration_request {
400 struct gb_i2s_mgmt_configuration config;
402 /* set configuration response has no payload */
404 struct gb_i2s_mgmt_set_samples_per_message_request {
405 __le16 samples_per_message;
407 /* set samples per message response has no payload */
409 /* get processing request delay has no payload */
410 struct gb_i2s_mgmt_get_processing_delay_response {
414 struct gb_i2s_mgmt_set_start_delay_request {
417 /* set start delay response has no payload */
419 struct gb_i2s_mgmt_activate_cport_request {
422 /* activate cport response has no payload */
424 struct gb_i2s_mgmt_deactivate_cport_request {
427 /* deactivate cport response has no payload */
429 struct gb_i2s_mgmt_report_event_request {
432 /* report event response has no payload */
434 #define GB_I2S_DATA_TYPE_PROTOCOL_VERSION 0x01
435 #define GB_I2S_DATA_TYPE_SEND_DATA 0x02
437 struct gb_i2s_send_data_request {
438 __le32 sample_number;
442 /* send data has no response at all */
447 /* Version of the Greybus spi protocol we support */
448 #define GB_SPI_VERSION_MAJOR 0x00
449 #define GB_SPI_VERSION_MINOR 0x01
451 /* Should match up with modes in linux/spi/spi.h */
452 #define GB_SPI_MODE_CPHA 0x01 /* clock phase */
453 #define GB_SPI_MODE_CPOL 0x02 /* clock polarity */
454 #define GB_SPI_MODE_MODE_0 (0|0) /* (original MicroWire) */
455 #define GB_SPI_MODE_MODE_1 (0|GB_SPI_MODE_CPHA)
456 #define GB_SPI_MODE_MODE_2 (GB_SPI_MODE_CPOL|0)
457 #define GB_SPI_MODE_MODE_3 (GB_SPI_MODE_CPOL|GB_SPI_MODE_CPHA)
458 #define GB_SPI_MODE_CS_HIGH 0x04 /* chipselect active high? */
459 #define GB_SPI_MODE_LSB_FIRST 0x08 /* per-word bits-on-wire */
460 #define GB_SPI_MODE_3WIRE 0x10 /* SI/SO signals shared */
461 #define GB_SPI_MODE_LOOP 0x20 /* loopback mode */
462 #define GB_SPI_MODE_NO_CS 0x40 /* 1 dev/bus, no chipselect */
463 #define GB_SPI_MODE_READY 0x80 /* slave pulls low to pause */
465 /* Should match up with flags in linux/spi/spi.h */
466 #define GB_SPI_FLAG_HALF_DUPLEX BIT(0) /* can't do full duplex */
467 #define GB_SPI_FLAG_NO_RX BIT(1) /* can't do buffer read */
468 #define GB_SPI_FLAG_NO_TX BIT(2) /* can't do buffer write */
470 /* Greybus spi operation types */
471 #define GB_SPI_TYPE_INVALID 0x00
472 #define GB_SPI_TYPE_PROTOCOL_VERSION 0x01
473 #define GB_SPI_TYPE_MODE 0x02
474 #define GB_SPI_TYPE_FLAGS 0x03
475 #define GB_SPI_TYPE_BITS_PER_WORD_MASK 0x04
476 #define GB_SPI_TYPE_NUM_CHIPSELECT 0x05
477 #define GB_SPI_TYPE_TRANSFER 0x06
479 /* mode request has no payload */
480 struct gb_spi_mode_response {
484 /* flags request has no payload */
485 struct gb_spi_flags_response {
489 /* bits-per-word request has no payload */
490 struct gb_spi_bpw_response {
491 __le32 bits_per_word_mask;
494 /* num-chipselects request has no payload */
495 struct gb_spi_chipselect_response {
496 __le16 num_chipselect;
500 * struct gb_spi_transfer - a read/write buffer pair
501 * @speed_hz: Select a speed other than the device default for this transfer. If
502 * 0 the default (from @spi_device) is used.
503 * @len: size of rx and tx buffers (in bytes)
504 * @delay_usecs: microseconds to delay after this transfer before (optionally)
505 * changing the chipselect status, then starting the next transfer or
506 * completing this spi_message.
507 * @cs_change: affects chipselect after this transfer completes
508 * @bits_per_word: select a bits_per_word other than the device default for this
509 * transfer. If 0 the default (from @spi_device) is used.
511 struct gb_spi_transfer {
519 struct gb_spi_transfer_request {
520 __u8 chip_select; /* of the spi device */
521 __u8 mode; /* of the spi device */
523 struct gb_spi_transfer transfers[0]; /* trnasfer_count of these */
526 struct gb_spi_transfer_response {
527 __u8 data[0]; /* inbound data */
530 /* Version of the Greybus SVC protocol we support */
531 #define GB_SVC_VERSION_MAJOR 0x00
532 #define GB_SVC_VERSION_MINOR 0x01
534 /* Greybus SVC request types */
535 #define GB_SVC_TYPE_INVALID 0x00
536 #define GB_SVC_TYPE_PROTOCOL_VERSION 0x01
537 #define GB_SVC_TYPE_INTF_DEVICE_ID 0x02
538 #define GB_SVC_TYPE_INTF_HOTPLUG 0x03
539 #define GB_SVC_TYPE_INTF_HOT_UNPLUG 0x04
540 #define GB_SVC_TYPE_INTF_RESET 0x05
541 #define GB_SVC_TYPE_CONN_CREATE 0x06
542 #define GB_SVC_TYPE_CONN_DESTROY 0x07
544 struct gb_svc_intf_device_id_request {
548 /* device id response has no payload */
550 struct gb_svc_intf_hotplug_request {
553 __le32 unipro_mfg_id;
554 __le32 unipro_prod_id;
559 /* hotplug response has no payload */
561 struct gb_svc_intf_hot_unplug_request {
564 /* hot unplug response has no payload */
566 struct gb_svc_intf_reset_request {
569 /* interface reset response has no payload */
571 struct gb_svc_conn_create_request {
577 /* connection create response has no payload */
579 struct gb_svc_conn_destroy_request {
585 /* connection destroy response has no payload */
589 /* Version of the Greybus UART protocol we support */
590 #define GB_UART_VERSION_MAJOR 0x00
591 #define GB_UART_VERSION_MINOR 0x01
593 /* Greybus UART operation types */
594 #define GB_UART_TYPE_INVALID 0x00
595 #define GB_UART_TYPE_PROTOCOL_VERSION 0x01
596 #define GB_UART_TYPE_SEND_DATA 0x02
597 #define GB_UART_TYPE_RECEIVE_DATA 0x03 /* Unsolicited data */
598 #define GB_UART_TYPE_SET_LINE_CODING 0x04
599 #define GB_UART_TYPE_SET_CONTROL_LINE_STATE 0x05
600 #define GB_UART_TYPE_SEND_BREAK 0x06
601 #define GB_UART_TYPE_SERIAL_STATE 0x07 /* Unsolicited data */
603 /* Represents data from AP -> Module */
604 struct gb_uart_send_data_request {
609 /* recv-data-request flags */
610 #define GB_UART_RECV_FLAG_FRAMING 0x01 /* Framing error */
611 #define GB_UART_RECV_FLAG_PARITY 0x02 /* Parity error */
612 #define GB_UART_RECV_FLAG_OVERRUN 0x04 /* Overrun error */
613 #define GB_UART_RECV_FLAG_BREAK 0x08 /* Break */
615 /* Represents data from Module -> AP */
616 struct gb_uart_recv_data_request {
622 struct gb_uart_set_line_coding_request {
625 #define GB_SERIAL_1_STOP_BITS 0
626 #define GB_SERIAL_1_5_STOP_BITS 1
627 #define GB_SERIAL_2_STOP_BITS 2
630 #define GB_SERIAL_NO_PARITY 0
631 #define GB_SERIAL_ODD_PARITY 1
632 #define GB_SERIAL_EVEN_PARITY 2
633 #define GB_SERIAL_MARK_PARITY 3
634 #define GB_SERIAL_SPACE_PARITY 4
639 /* output control lines */
640 #define GB_UART_CTRL_DTR 0x01
641 #define GB_UART_CTRL_RTS 0x02
643 struct gb_uart_set_control_line_state_request {
647 struct gb_uart_set_break_request {
651 /* input control lines and line errors */
652 #define GB_UART_CTRL_DCD 0x01
653 #define GB_UART_CTRL_DSR 0x02
654 #define GB_UART_CTRL_RI 0x04
656 struct gb_uart_serial_state_request {
662 /* Version of the Greybus loopback protocol we support */
663 #define GB_LOOPBACK_VERSION_MAJOR 0x00
664 #define GB_LOOPBACK_VERSION_MINOR 0x01
666 /* Greybus loopback request types */
667 #define GB_LOOPBACK_TYPE_INVALID 0x00
668 #define GB_LOOPBACK_TYPE_PROTOCOL_VERSION 0x01
669 #define GB_LOOPBACK_TYPE_PING 0x02
670 #define GB_LOOPBACK_TYPE_TRANSFER 0x03
671 #define GB_LOOPBACK_TYPE_SINK 0x04
673 struct gb_loopback_transfer_request {
678 struct gb_loopback_transfer_response {
683 /* Version of the Greybus sdio protocol we support */
684 #define GB_SDIO_VERSION_MAJOR 0x00
685 #define GB_SDIO_VERSION_MINOR 0x01
687 /* Greybus SDIO operation types */
688 #define GB_SDIO_TYPE_INVALID 0x00
689 #define GB_SDIO_TYPE_PROTOCOL_VERSION 0x01
690 #define GB_SDIO_TYPE_GET_CAPABILITIES 0x02
691 #define GB_SDIO_TYPE_SET_IOS 0x03
692 #define GB_SDIO_TYPE_COMMAND 0x04
693 #define GB_SDIO_TYPE_TRANSFER 0x05
694 #define GB_SDIO_TYPE_EVENT 0x06
696 /* get caps response: request has no payload */
697 struct gb_sdio_get_caps_response {
699 #define GB_SDIO_CAP_NONREMOVABLE 0x00000001
700 #define GB_SDIO_CAP_4_BIT_DATA 0x00000002
701 #define GB_SDIO_CAP_8_BIT_DATA 0x00000004
702 #define GB_SDIO_CAP_MMC_HS 0x00000008
703 #define GB_SDIO_CAP_SD_HS 0x00000010
704 #define GB_SDIO_CAP_ERASE 0x00000020
705 #define GB_SDIO_CAP_1_2V_DDR 0x00000040
706 #define GB_SDIO_CAP_1_8V_DDR 0x00000080
707 #define GB_SDIO_CAP_POWER_OFF_CARD 0x00000100
708 #define GB_SDIO_CAP_UHS_SDR12 0x00000200
709 #define GB_SDIO_CAP_UHS_SDR25 0x00000400
710 #define GB_SDIO_CAP_UHS_SDR50 0x00000800
711 #define GB_SDIO_CAP_UHS_SDR104 0x00001000
712 #define GB_SDIO_CAP_UHS_DDR50 0x00002000
713 #define GB_SDIO_CAP_DRIVER_TYPE_A 0x00004000
714 #define GB_SDIO_CAP_DRIVER_TYPE_C 0x00008000
715 #define GB_SDIO_CAP_DRIVER_TYPE_D 0x00010000
716 #define GB_SDIO_CAP_HS200_1_2V 0x00020000
717 #define GB_SDIO_CAP_HS200_1_8V 0x00040000
718 #define GB_SDIO_CAP_HS400_1_2V 0x00080000
719 #define GB_SDIO_CAP_HS400_1_8V 0x00100000
721 /* see possible values below at vdd */
723 __le16 max_blk_count;
727 /* set ios request: response has no payload */
728 struct gb_sdio_set_ios_request {
731 #define GB_SDIO_VDD_165_195 0x00000001
732 #define GB_SDIO_VDD_20_21 0x00000002
733 #define GB_SDIO_VDD_21_22 0x00000004
734 #define GB_SDIO_VDD_22_23 0x00000008
735 #define GB_SDIO_VDD_23_24 0x00000010
736 #define GB_SDIO_VDD_24_25 0x00000020
737 #define GB_SDIO_VDD_25_26 0x00000040
738 #define GB_SDIO_VDD_26_27 0x00000080
739 #define GB_SDIO_VDD_27_28 0x00000100
740 #define GB_SDIO_VDD_28_29 0x00000200
741 #define GB_SDIO_VDD_29_30 0x00000400
742 #define GB_SDIO_VDD_30_31 0x00000800
743 #define GB_SDIO_VDD_31_32 0x00001000
744 #define GB_SDIO_VDD_32_33 0x00002000
745 #define GB_SDIO_VDD_33_34 0x00004000
746 #define GB_SDIO_VDD_34_35 0x00008000
747 #define GB_SDIO_VDD_35_36 0x00010000
750 #define GB_SDIO_BUSMODE_OPENDRAIN 0x00
751 #define GB_SDIO_BUSMODE_PUSHPULL 0x01
754 #define GB_SDIO_POWER_OFF 0x00
755 #define GB_SDIO_POWER_UP 0x01
756 #define GB_SDIO_POWER_ON 0x02
757 #define GB_SDIO_POWER_UNDEFINED 0x03
760 #define GB_SDIO_BUS_WIDTH_1 0x00
761 #define GB_SDIO_BUS_WIDTH_4 0x02
762 #define GB_SDIO_BUS_WIDTH_8 0x03
765 #define GB_SDIO_TIMING_LEGACY 0x00
766 #define GB_SDIO_TIMING_MMC_HS 0x01
767 #define GB_SDIO_TIMING_SD_HS 0x02
768 #define GB_SDIO_TIMING_UHS_SDR12 0x03
769 #define GB_SDIO_TIMING_UHS_SDR25 0x04
770 #define GB_SDIO_TIMING_UHS_SDR50 0x05
771 #define GB_SDIO_TIMING_UHS_SDR104 0x06
772 #define GB_SDIO_TIMING_UHS_DDR50 0x07
773 #define GB_SDIO_TIMING_MMC_DDR52 0x08
774 #define GB_SDIO_TIMING_MMC_HS200 0x09
775 #define GB_SDIO_TIMING_MMC_HS400 0x0A
778 #define GB_SDIO_SIGNAL_VOLTAGE_330 0x00
779 #define GB_SDIO_SIGNAL_VOLTAGE_180 0x01
780 #define GB_SDIO_SIGNAL_VOLTAGE_120 0x02
783 #define GB_SDIO_SET_DRIVER_TYPE_B 0x00
784 #define GB_SDIO_SET_DRIVER_TYPE_A 0x01
785 #define GB_SDIO_SET_DRIVER_TYPE_C 0x02
786 #define GB_SDIO_SET_DRIVER_TYPE_D 0x03
789 /* command request */
790 struct gb_sdio_command_request {
793 #define GB_SDIO_RSP_NONE 0x00
794 #define GB_SDIO_RSP_PRESENT 0x01
795 #define GB_SDIO_RSP_136 0x02
796 #define GB_SDIO_RSP_CRC 0x04
797 #define GB_SDIO_RSP_BUSY 0x08
798 #define GB_SDIO_RSP_OPCODE 0x10
801 #define GB_SDIO_CMD_AC 0x00
802 #define GB_SDIO_CMD_ADTC 0x01
803 #define GB_SDIO_CMD_BCR 0x02
804 #define GB_SDIO_CMD_BC 0x03
809 struct gb_sdio_command_response {
813 /* transfer request */
814 struct gb_sdio_transfer_request {
816 #define GB_SDIO_DATA_WRITE 0x01
817 #define GB_SDIO_DATA_READ 0x02
818 #define GB_SDIO_DATA_STREAM 0x04
825 struct gb_sdio_transfer_response {
831 /* event request: generated by module and is defined as unidirectional */
832 struct gb_sdio_event_request {
834 #define GB_SDIO_CARD_INSERTED 0x01
835 #define GB_SDIO_CARD_REMOVED 0x02
836 #define GB_SDIO_WP 0x04
839 #endif /* __GREYBUS_PROTOCOLS_H */