• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18 
19 #ifndef __OAL_SDIO_H__
20 #define __OAL_SDIO_H__
21 
22 #ifdef __cplusplus
23 #if __cplusplus
24 extern "C" {
25 #endif
26 #endif
27 
28 #ifdef  CONFIG_HI110X_SDIO_STD_CARD_SUPPORT
29 #define HISDIO_VENDOR_ID_HISI                      0x0296      /* VENDOR ID */
30 #define HISDIO_PRODUCT_ID_HISI                     0x5347      /* Product 1102 */
31 #else
32 #define HISDIO_VENDOR_ID_HISI                      0x22D1      /* VENDOR ID */
33 #define HISDIO_PRODUCT_ID_HISI                     0x1101      /* Product 1102 */
34 #endif
35 
36 #define SDIO_MAX_CONTINUS_RX_COUNT                 64          /* sdio max continus rx cnt */
37 
38 #define HISDIO_REG_FUNC1_FIFO                      0x00        /* Read Write FIFO */
39 #define HISDIO_REG_FUNC1_INT_STATUS                0x08        /* interrupt mask and clear reg */
40 #define HISDIO_REG_FUNC1_INT_ENABLE                0x09        /* interrupt */
41 #define HISDIO_REG_FUNC1_XFER_COUNT                0x0c        /* notify number of bytes to be read */
42 #define HISDIO_REG_FUNC1_WRITE_MSG                 0x24        /* write msg to device */
43 #define HISDIO_REG_FUNC1_MSG_FROM_DEV              0x28        /* notify Host that device has got the msg */
44 #define HISDIO_REG_FUNC1_MSG_HIGH_FROM_DEV         0x2b        /* Host receive the msg ack */
45 
46 /* sdio extend function, add 64B register for hcc */
47 #define HISDIO_FUNC1_EXTEND_REG_BASE        0x3c
48 #define HISDIO_FUNC1_EXTEND_REG_LEN         64
49 
50 #define HISDIO_FUNC1_INT_DREADY             (1 << 0)           /* data ready interrupt */
51 #define HISDIO_FUNC1_INT_RERROR             (1 << 1)           /* data read error interrupt */
52 #define HISDIO_FUNC1_INT_MFARM              (1 << 2)           /* ARM Msg interrupt */
53 #define HISDIO_FUNC1_INT_ACK                (1 << 3)           /* ACK interrupt */
54 
55 #define HISDIO_FUNC1_INT_MASK (HISDIO_FUNC1_INT_DREADY | HISDIO_FUNC1_INT_RERROR | HISDIO_FUNC1_INT_MFARM)
56 
57 #define HISDIO_RX_THREAD_NICE               (-20)
58 #define HISDIO_SDIO_RX_THREAD_POLICY        OAL_SCHED_FIFO
59 #if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION)
60 #define HISDIO_GPIO_RX_THREAD_PRIORITY      20
61 #elif (_PRE_OS_VERSION_LITEOS == _PRE_OS_VERSION)
62 #define HISDIO_GPIO_RX_THREAD_PRIORITY      2
63 #endif
64 
65 #define HISDIO_RX_THREAD_PRIORITY           99
66 
67 #define HISDIO_SDIO_DISPOSE_THREAD_PRIORITY 10
68 #define HISDIO_RX_THREAD_STACKSIZE          0x6000
69 
70 #if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION)
71 extern void hisi_sdio_rescan(int slot);
72 #else
73 extern int hisi_sdio_rescan(int slot);
74 #endif
75 
76 #ifdef __cplusplus
77 #if __cplusplus
78 }
79 #endif
80 #endif
81 
82 #endif /* end of oal_sdio.h */
83