Commit 3b6ecd6d authored by Rui Miguel Silva's avatar Rui Miguel Silva Committed by Greg Kroah-Hartman

greybus: sdio: extend sdio implementation

Extend sdio implementation, as it for now it was basically stubs.

This implementation is compile tested only since there is no fw or
simulation support yet.
Next step is to add sdio support to gbsim and test it with success
using the mmc_test facility.
Signed-off-by: default avatarRui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 656f22e9
......@@ -616,5 +616,165 @@ struct gb_uart_serial_state_request {
__le16 control;
};
/* SDIO */
/* Version of the Greybus sdio protocol we support */
#define GB_SDIO_VERSION_MAJOR 0x00
#define GB_SDIO_VERSION_MINOR 0x01
/* 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_INVALID 0x00
#define GB_SDIO_TYPE_PROTOCOL_VERSION 0x01
#define GB_SDIO_TYPE_GET_CAPABILITIES 0x02
#define GB_SDIO_TYPE_SET_IOS 0x03
#define GB_SDIO_TYPE_COMMAND 0x04
#define GB_SDIO_TYPE_TRANSFER 0x05
#define GB_SDIO_TYPE_EVENT 0x06
/* get caps response: request has no payload */
struct gb_sdio_get_caps_response {
__le32 caps;
#define GB_SDIO_CAP_NONREMOVABLE 0x00000001
#define GB_SDIO_CAP_4_BIT_DATA 0x00000002
#define GB_SDIO_CAP_8_BIT_DATA 0x00000004
#define GB_SDIO_CAP_MMC_HS 0x00000008
#define GB_SDIO_CAP_SD_HS 0x00000010
#define GB_SDIO_CAP_ERASE 0x00000020
#define GB_SDIO_CAP_1_2V_DDR 0x00000040
#define GB_SDIO_CAP_1_8V_DDR 0x00000080
#define GB_SDIO_CAP_POWER_OFF_CARD 0x00000100
#define GB_SDIO_CAP_UHS_SDR12 0x00000200
#define GB_SDIO_CAP_UHS_SDR25 0x00000400
#define GB_SDIO_CAP_UHS_SDR50 0x00000800
#define GB_SDIO_CAP_UHS_SDR104 0x00001000
#define GB_SDIO_CAP_UHS_DDR50 0x00002000
#define GB_SDIO_CAP_DRIVER_TYPE_A 0x00004000
#define GB_SDIO_CAP_DRIVER_TYPE_C 0x00008000
#define GB_SDIO_CAP_DRIVER_TYPE_D 0x00010000
#define GB_SDIO_CAP_HS200_1_2V 0x00020000
#define GB_SDIO_CAP_HS200_1_8V 0x00040000
#define GB_SDIO_CAP_HS400_1_2V 0x00080000
#define GB_SDIO_CAP_HS400_1_8V 0x00100000
/* see possible values below at vdd */
__le32 ocr;
__le16 max_blk_count;
__le16 max_blk_size;
};
/* set ios request: response has no payload */
struct gb_sdio_set_ios_request {
__le32 clock;
__le32 vdd;
#define GB_SDIO_VDD_165_195 0x00000001
#define GB_SDIO_VDD_20_21 0x00000002
#define GB_SDIO_VDD_21_22 0x00000004
#define GB_SDIO_VDD_22_23 0x00000008
#define GB_SDIO_VDD_23_24 0x00000010
#define GB_SDIO_VDD_24_25 0x00000020
#define GB_SDIO_VDD_25_26 0x00000040
#define GB_SDIO_VDD_26_27 0x00000080
#define GB_SDIO_VDD_27_28 0x00000100
#define GB_SDIO_VDD_28_29 0x00000200
#define GB_SDIO_VDD_29_30 0x00000400
#define GB_SDIO_VDD_30_31 0x00000800
#define GB_SDIO_VDD_31_32 0x00001000
#define GB_SDIO_VDD_32_33 0x00002000
#define GB_SDIO_VDD_33_34 0x00004000
#define GB_SDIO_VDD_34_35 0x00008000
#define GB_SDIO_VDD_35_36 0x00010000
__u8 bus_mode;
#define GB_SDIO_BUSMODE_OPENDRAIN 0x00
#define GB_SDIO_BUSMODE_PUSHPULL 0x01
__u8 power_mode;
#define GB_SDIO_POWER_OFF 0x00
#define GB_SDIO_POWER_UP 0x01
#define GB_SDIO_POWER_ON 0x02
#define GB_SDIO_POWER_UNDEFINED 0x03
__u8 bus_width;
#define GB_SDIO_BUS_WIDTH_1 0x00
#define GB_SDIO_BUS_WIDTH_4 0x02
#define GB_SDIO_BUS_WIDTH_8 0x03
__u8 timing;
#define GB_SDIO_TIMING_LEGACY 0x00
#define GB_SDIO_TIMING_MMC_HS 0x01
#define GB_SDIO_TIMING_SD_HS 0x02
#define GB_SDIO_TIMING_UHS_SDR12 0x03
#define GB_SDIO_TIMING_UHS_SDR25 0x04
#define GB_SDIO_TIMING_UHS_SDR50 0x05
#define GB_SDIO_TIMING_UHS_SDR104 0x06
#define GB_SDIO_TIMING_UHS_DDR50 0x07
#define GB_SDIO_TIMING_MMC_DDR52 0x08
#define GB_SDIO_TIMING_MMC_HS200 0x09
#define GB_SDIO_TIMING_MMC_HS400 0x0A
__u8 signal_voltage;
#define GB_SDIO_SIGNAL_VOLTAGE_330 0x00
#define GB_SDIO_SIGNAL_VOLTAGE_180 0x01
#define GB_SDIO_SIGNAL_VOLTAGE_120 0x02
__u8 drv_type;
#define GB_SDIO_SET_DRIVER_TYPE_B 0x00
#define GB_SDIO_SET_DRIVER_TYPE_A 0x01
#define GB_SDIO_SET_DRIVER_TYPE_C 0x02
#define GB_SDIO_SET_DRIVER_TYPE_D 0x03
};
/* command request */
struct gb_sdio_command_request {
__u8 cmd;
__u8 cmd_flags;
#define GB_SDIO_RSP_NONE 0x00
#define GB_SDIO_RSP_R1_R5_R6_R7 0x01
#define GB_SDIO_RSP_R1B 0x02
#define GB_SDIO_RSP_R2 0x03
#define GB_SDIO_RSP_R3_R4 0x04
__u8 cmd_type;
#define GB_SDIO_CMD_AC 0x00
#define GB_SDIO_CMD_ADTC 0x01
#define GB_SDIO_CMD_BCR 0x02
#define GB_SDIO_CMD_BC 0x03
__le32 cmd_arg;
};
struct gb_sdio_command_response {
__le32 resp[4];
};
/* transfer request */
struct gb_sdio_transfer_request {
__u8 data_flags;
#define GB_SDIO_DATA_WRITE 0x01
#define GB_SDIO_DATA_READ 0x02
#define GB_SDIO_DATA_STREAM 0x04
__le16 data_blocks;
__le16 data_blksz;
__u8 data[0];
};
struct gb_sdio_transfer_response {
__le16 data_blocks;
__le16 data_blksz;
__u8 data[0];
};
/* event request: generated by module and is defined as unidirectional */
struct gb_sdio_event_request {
__u8 event;
#define GB_SDIO_CARD_INSERTED 0x01
#define GB_SDIO_CARD_REMOVED 0x02
#define GB_SDIO_WP 0x04
};
#endif /* __GREYBUS_PROTOCOLS_H */
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment