blob: 7c2fef7568e85c68922ad495855424dee429723f [file] [log] [blame]
Amol Jadi84a546a2011-03-02 12:09:11 -08001/*
Duy Truongf3ac7b32013-02-13 01:07:28 -08002 * Copyright (c) 2011, The Linux Foundation. All rights reserved.
Amol Jadi84a546a2011-03-02 12:09:11 -08003 *
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 Truongf3ac7b32013-02-13 01:07:28 -080013 * * Neither the name of The Linux Foundation nor the names of its
Amol Jadi84a546a2011-03-02 12:09:11 -080014 * 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 Jadi84a546a2011-03-02 12:09:11 -080035/* 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 Jadi84a546a2011-03-02 12:09:11 -080052/* Command Pointer List Entry bit masks */
Ajay Dudanib01e5062011-12-03 23:23:42 -080053#define ADM_CMD_PTR_LP (1 << 31) /* Last pointer */
54#define ADM_CMD_PTR_CMD_LIST (0 << 29) /* Command List */
Amol Jadi84a546a2011-03-02 12:09:11 -080055
56/* Command List bit masks */
Ajay Dudanib01e5062011-12-03 23:23:42 -080057#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 Jadi84a546a2011-03-02 12:09:11 -080063
64/* ADM external inteface */
65
66/* result type */
Ajay Dudanib01e5062011-12-03 23:23:42 -080067typedef enum {
Amol Jadi84a546a2011-03-02 12:09:11 -080068
Ajay Dudanib01e5062011-12-03 23:23:42 -080069 ADM_RESULT_SUCCESS = 0,
70 ADM_RESULT_FAILURE = 1,
71 ADM_RESULT_TIMEOUT = 2
Amol Jadi84a546a2011-03-02 12:09:11 -080072} adm_result_t;
73
Amol Jadi84a546a2011-03-02 12:09:11 -080074/* direction type */
Ajay Dudanib01e5062011-12-03 23:23:42 -080075typedef enum {
Amol Jadi84a546a2011-03-02 12:09:11 -080076
Ajay Dudanib01e5062011-12-03 23:23:42 -080077 ADM_MMC_READ = 0,
78 ADM_MMC_WRITE
Amol Jadi84a546a2011-03-02 12:09:11 -080079} adm_dir_t;
80
81adm_result_t adm_transfer_mmc_data(unsigned char slot,
Ajay Dudanib01e5062011-12-03 23:23:42 -080082 unsigned char *data_ptr,
83 unsigned int data_len, adm_dir_t dir);
Amol Jadi84a546a2011-03-02 12:09:11 -080084#endif