1 // Copyright (C) 2022 Beken Corporation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 17 #include <common/bk_err.h> 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 typedef uint8_t sdio_host_unit_t; /**< sdio host uint id */ 24 25 #if (CONFIG_SOC_BK7256XX) 26 typedef enum { 27 SDIO_HOST_CLK_13M = 0, /**< 2 division of clock frequency */ 28 SDIO_HOST_CLK_6_5M = 1, /**< 4 division of clock frequency */ 29 SDIO_HOST_CLK_4_3M = 2, /**< 6 division of clock frequency */ 30 SDIO_HOST_CLK_3_2M = 3, /**< 8 division of clock frequency */ 31 32 SDIO_HOST_CLK_2_6M = 4, /**< 10 division of clock frequency */ 33 SDIO_HOST_CLK_2_2M = 5, /**< 12 division of clock frequency */ 34 35 SDIO_HOST_CLK_1_6M = 6, /**< 16 division of clock frequency */ 36 SDIO_HOST_CLK_100K = 7, /**< 256 division of clock frequency */ 37 38 SDIO_HOST_CLK_80M = 9, /**< 320M/4 division of clock frequency */ 39 SDIO_HOST_CLK_40M = 11, /**< 320M/8 division of clock frequency */ 40 SDIO_HOST_CLK_20M = 14, /**< 320M/16 division of clock frequency */ 41 42 } sdio_host_clock_freq_t; 43 #else 44 typedef enum { 45 SDIO_HOST_CLK_26M = 26000000, /**< 1 division of clock frequency */ 46 SDIO_HOST_CLK_13M = 13000000, /**< 2 division of clock frequency */ 47 SDIO_HOST_CLK_6_5M = 6500000, /**< 4 division of clock frequency */ 48 SDIO_HOST_CLK_3_2_5M = 3250000, /**< 8 division of clock frequency */ 49 SDIO_HOST_CLK_1_6M = 1600000, /**< 16 division of clock frequency */ 50 SDIO_HOST_CLK_800K = 800000, /**< 32 division of clock frequency */ 51 SDIO_HOST_CLK_400K = 400000, /**< 64 division of clock frequency */ 52 SDIO_HOST_CLK_200K = 200000, /**< 128 division of clock frequency */ 53 SDIO_HOST_CLK_100K = 100000, /**< 256 division of clock frequency */ 54 } sdio_host_clock_freq_t; 55 #endif 56 57 typedef enum { 58 SDIO_HOST_CMD_RSP_NONE = 0, /**< sdio host not need slave respond the command */ 59 SDIO_HOST_CMD_RSP_SHORT, /**< sdio host need slave long response */ 60 SDIO_HOST_CMD_RSP_LONG, /**< sdio host need slave short response */ 61 } sdio_host_cmd_rsp_t; 62 63 typedef enum { 64 SDIO_HOST_BUS_WIDTH_1LINE = 0, /**< sdio host bus width 1 line */ 65 SDIO_HOST_BUS_WIDTH_4LINE, /**< sdio host bus width 4 line */ 66 } sdio_host_bus_width_t; 67 68 typedef enum { 69 SDIO_HOST_RSP0 = 0, /**< sdio host response regiseter 0 */ 70 SDIO_HOST_RSP1, /**< sdio host response regiseter 1 */ 71 SDIO_HOST_RSP2, /**< sdio host response regiseter 2 */ 72 SDIO_HOST_RSP3, /**< sdio host response regiseter 3 */ 73 } sdio_host_response_t; 74 75 typedef struct { 76 uint32_t cmd_index; /**< sdio command index, between 0 and 63 */ 77 uint32_t argument; /**< sdio command argument */ 78 sdio_host_cmd_rsp_t response; /**< sdio command response type */ 79 uint32_t wait_rsp_timeout; /**< sdio host wait for slave command response timeout */ 80 bool crc_check; /**< sdio host whether need to check slave response crc value */ 81 } sdio_host_cmd_cfg_t; 82 83 #ifdef __cplusplus 84 } 85 #endif 86 87