Amol Jadi | 84a546a | 2011-03-02 12:09:11 -0800 | [diff] [blame] | 1 | /* |
Duy Truong | f3ac7b3 | 2013-02-13 01:07:28 -0800 | [diff] [blame] | 2 | * Copyright (c) 2011, The Linux Foundation. All rights reserved. |
Amol Jadi | 84a546a | 2011-03-02 12:09:11 -0800 | [diff] [blame] | 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions are |
| 6 | * met: |
| 7 | * * Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * * Redistributions in binary form must reproduce the above |
| 10 | * copyright notice, this list of conditions and the following |
| 11 | * disclaimer in the documentation and/or other materials provided |
| 12 | * with the distribution. |
Duy Truong | f3ac7b3 | 2013-02-13 01:07:28 -0800 | [diff] [blame] | 13 | * * Neither the name of The Linux Foundation nor the names of its |
Amol Jadi | 84a546a | 2011-03-02 12:09:11 -0800 | [diff] [blame] | 14 | * contributors may be used to endorse or promote products derived |
| 15 | * from this software without specific prior written permission. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | */ |
| 29 | |
| 30 | #ifndef __PLATFORM_MSM_SHARED_ADM_H |
| 31 | #define __PLATFORM_MSM_SHARED_ADM_H |
| 32 | |
| 33 | #include <platform/iomap.h> |
| 34 | |
Amol Jadi | 84a546a | 2011-03-02 12:09:11 -0800 | [diff] [blame] | 35 | /* ADM base address for channel (n) and security_domain (s) */ |
| 36 | #define ADM_BASE_ADDR(n, s) (MSM_ADM_BASE + 4*(n) + ((MSM_ADM_SD_OFFSET)*(s))) |
| 37 | |
| 38 | /* ADM registers */ |
| 39 | #define ADM_REG_CMD_PTR(n, s) (ADM_BASE_ADDR(n, s) + 0x000) |
| 40 | #define ADM_REG_RSLT(n, s) (ADM_BASE_ADDR(n, s) + 0x040) |
| 41 | #define ADM_REG_STATUS(n, s) (ADM_BASE_ADDR(n, s) + 0x200) |
| 42 | #define ADM_REG_IRQ(s) (ADM_BASE_ADDR(0, s) + 0x380) |
| 43 | |
| 44 | /* Result reg bit masks */ |
| 45 | #define ADM_REG_RSLT__V___M (1 << 31) |
| 46 | #define ADM_REG_RSLT__ERR___M (1 << 3) |
| 47 | #define ADM_REG_RSLT__TPD___M (1 << 1) |
| 48 | |
| 49 | /* Status reg bit masks */ |
| 50 | #define ADM_REG_STATUS__RSLT_VLD___M (1 << 1) |
| 51 | |
Amol Jadi | 84a546a | 2011-03-02 12:09:11 -0800 | [diff] [blame] | 52 | /* Command Pointer List Entry bit masks */ |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 53 | #define ADM_CMD_PTR_LP (1 << 31) /* Last pointer */ |
| 54 | #define ADM_CMD_PTR_CMD_LIST (0 << 29) /* Command List */ |
Amol Jadi | 84a546a | 2011-03-02 12:09:11 -0800 | [diff] [blame] | 55 | |
| 56 | /* Command List bit masks */ |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 57 | #define ADM_CMD_LIST_LC (1 << 31) /* Last command */ |
| 58 | #define ADM_CMD_LIST_OCU (1 << 21) /* Other channel unblock */ |
| 59 | #define ADM_CMD_LIST_OCB (1 << 20) /* Other channel block */ |
| 60 | #define ADM_CMD_LIST_TCB (1 << 19) /* This channel block */ |
| 61 | #define ADM_ADDR_MODE_BOX (3 << 0) /* Box address mode */ |
| 62 | #define ADM_ADDR_MODE_SI (0 << 0) /* Single item address mode */ |
Amol Jadi | 84a546a | 2011-03-02 12:09:11 -0800 | [diff] [blame] | 63 | |
| 64 | /* ADM external inteface */ |
| 65 | |
| 66 | /* result type */ |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 67 | typedef enum { |
Amol Jadi | 84a546a | 2011-03-02 12:09:11 -0800 | [diff] [blame] | 68 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 69 | ADM_RESULT_SUCCESS = 0, |
| 70 | ADM_RESULT_FAILURE = 1, |
| 71 | ADM_RESULT_TIMEOUT = 2 |
Amol Jadi | 84a546a | 2011-03-02 12:09:11 -0800 | [diff] [blame] | 72 | } adm_result_t; |
| 73 | |
Amol Jadi | 84a546a | 2011-03-02 12:09:11 -0800 | [diff] [blame] | 74 | /* direction type */ |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 75 | typedef enum { |
Amol Jadi | 84a546a | 2011-03-02 12:09:11 -0800 | [diff] [blame] | 76 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 77 | ADM_MMC_READ = 0, |
| 78 | ADM_MMC_WRITE |
Amol Jadi | 84a546a | 2011-03-02 12:09:11 -0800 | [diff] [blame] | 79 | } adm_dir_t; |
| 80 | |
| 81 | adm_result_t adm_transfer_mmc_data(unsigned char slot, |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 82 | unsigned char *data_ptr, |
| 83 | unsigned int data_len, adm_dir_t dir); |
Amol Jadi | 84a546a | 2011-03-02 12:09:11 -0800 | [diff] [blame] | 84 | #endif |