Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2008, Google Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * * Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * * Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in |
| 12 | * the documentation and/or other materials provided with the |
| 13 | * distribution. |
| 14 | * |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 16 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 17 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 18 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 19 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
| 22 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 25 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 26 | * SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #ifndef __PLATFORM_MSM_SHARED_DMOV_H |
| 30 | #define __PLATFORM_MSM_SHARED_DMOV_H |
| 31 | |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 32 | #ifdef PLATFORM_MSM7X30 |
| 33 | #define MSM_DMOV_BASE 0xAC400000 |
| 34 | #else |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 35 | #ifdef PLATFORM_MDM9X15 //TODO: Move to IOMAP |
Kinson Chik | 18e3633 | 2011-08-15 10:07:28 -0700 | [diff] [blame] | 36 | #define MSM_DMOV_BASE 0x18300000 |
| 37 | #else |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 38 | #define MSM_DMOV_BASE 0xA9700000 |
| 39 | #endif |
Kinson Chik | 18e3633 | 2011-08-15 10:07:28 -0700 | [diff] [blame] | 40 | #endif |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 41 | |
Kinson Chik | 18e3633 | 2011-08-15 10:07:28 -0700 | [diff] [blame] | 42 | #ifdef PLATFORM_MDM9X15 |
| 43 | #define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x00000 + (off) + ((ch) << 2)) |
| 44 | #define DMOV_SD1(off, ch) (MSM_DMOV_BASE + 0x20800 + (off) + ((ch) << 2)) |
| 45 | #define DMOV_SD2(off, ch) (MSM_DMOV_BASE + 0x41000 + (off) + ((ch) << 2)) |
| 46 | #define DMOV_SD3(off, ch) (MSM_DMOV_BASE + 0x81800 + (off) + ((ch) << 2)) |
| 47 | #else |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 48 | /* see 80-VA736-2 C pp 415-439 */ |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 49 | #define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x0000 + (off) + ((ch) << 2)) |
| 50 | #define DMOV_SD1(off, ch) (MSM_DMOV_BASE + 0x0400 + (off) + ((ch) << 2)) |
| 51 | #define DMOV_SD2(off, ch) (MSM_DMOV_BASE + 0x0800 + (off) + ((ch) << 2)) |
| 52 | #define DMOV_SD3(off, ch) (MSM_DMOV_BASE + 0x0C00 + (off) + ((ch) << 2)) |
Kinson Chik | 18e3633 | 2011-08-15 10:07:28 -0700 | [diff] [blame] | 53 | #endif |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 54 | |
| 55 | #ifdef PLATFORM_MSM7X30 |
| 56 | #define DMOV_SDn DMOV_SD2 |
| 57 | #else |
Kinson Chik | 18e3633 | 2011-08-15 10:07:28 -0700 | [diff] [blame] | 58 | #ifdef PLATFORM_MDM9X15 |
| 59 | #define DMOV_SDn DMOV_SD1 |
| 60 | #else |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 61 | #define DMOV_SDn DMOV_SD3 |
| 62 | #endif |
Kinson Chik | 18e3633 | 2011-08-15 10:07:28 -0700 | [diff] [blame] | 63 | #endif |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 64 | |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 65 | /* only security domain 3 is available to the ARM11 |
| 66 | ** |
| 67 | ** SD0 -> mARM trusted, SD1 -> mARM nontrusted, SD2 -> aDSP, SD3 -> aARM |
| 68 | ** |
| 69 | */ |
| 70 | |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 71 | #define DMOV_CMD_PTR(ch) DMOV_SDn(0x000, ch) |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 72 | #define DMOV_CMD_LIST (0 << 29) /* does not work */ |
| 73 | #define DMOV_CMD_PTR_LIST (1 << 29) /* works */ |
| 74 | #define DMOV_CMD_INPUT_CFG (2 << 29) /* untested */ |
| 75 | #define DMOV_CMD_OUTPUT_CFG (3 << 29) /* untested */ |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 76 | #define DMOV_CMD_ADDR(addr) ((addr) >> 3) |
| 77 | |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 78 | #define DMOV_RSLT(ch) DMOV_SDn(0x040, ch) |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 79 | #define DMOV_RSLT_VALID (1 << 31) /* 0 == host has empties result fifo */ |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 80 | #define DMOV_RSLT_ERROR (1 << 3) |
| 81 | #define DMOV_RSLT_FLUSH (1 << 2) |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 82 | #define DMOV_RSLT_DONE (1 << 1) /* top pointer done */ |
| 83 | #define DMOV_RSLT_USER (1 << 0) /* command with FR force result */ |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 84 | |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 85 | #define DMOV_FLUSH0(ch) DMOV_SDn(0x080, ch) |
| 86 | #define DMOV_FLUSH1(ch) DMOV_SDn(0x0C0, ch) |
| 87 | #define DMOV_FLUSH2(ch) DMOV_SDn(0x100, ch) |
| 88 | #define DMOV_FLUSH3(ch) DMOV_SDn(0x140, ch) |
| 89 | #define DMOV_FLUSH4(ch) DMOV_SDn(0x180, ch) |
| 90 | #define DMOV_FLUSH5(ch) DMOV_SDn(0x1C0, ch) |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 91 | |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 92 | #define DMOV_STATUS(ch) DMOV_SDn(0x200, ch) |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 93 | #define DMOV_STATUS_RSLT_COUNT(n) (((n) >> 29)) |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 94 | #define DMOV_STATUS_CMD_COUNT(n) (((n) >> 27) & 3) |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 95 | #define DMOV_STATUS_RSLT_VALID (1 << 1) |
| 96 | #define DMOV_STATUS_CMD_PTR_RDY (1 << 0) |
| 97 | |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 98 | #define DMOV_ISR DMOV_SDn(0x380, 0) |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 99 | |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 100 | #define DMOV_CONFIG(ch) DMOV_SDn(0x300, ch) |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 101 | #define DMOV_CONFIG_FORCE_TOP_PTR_RSLT (1 << 2) |
| 102 | #define DMOV_CONFIG_FOREC_FLUSH_RSLT (1 << 1) |
| 103 | #define DMOV_CONFIG_IRQ_EN (1 << 0) |
| 104 | |
| 105 | /* channel assignments - from qc/dmov_7500.h */ |
| 106 | |
Kinson Chik | 18e3633 | 2011-08-15 10:07:28 -0700 | [diff] [blame] | 107 | #ifdef PLATFORM_MDM9X15 |
| 108 | #define DMOV_NAND_CHAN 3 |
| 109 | #define DMOV_NAND_CRCI_CMD 15 |
| 110 | #define DMOV_NAND_CRCI_DATA 3 |
| 111 | #else |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 112 | #define DMOV_NAND_CHAN 7 |
| 113 | #define DMOV_NAND_CRCI_CMD 5 |
| 114 | #define DMOV_NAND_CRCI_DATA 4 |
Kinson Chik | 18e3633 | 2011-08-15 10:07:28 -0700 | [diff] [blame] | 115 | #endif |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 116 | |
| 117 | #define DMOV_SDC1_CHAN 8 |
| 118 | #define DMOV_SDC1_CRCI 6 |
| 119 | |
| 120 | #define DMOV_SDC2_CHAN 8 |
| 121 | #define DMOV_SDC2_CRCI 7 |
| 122 | |
| 123 | #define DMOV_TSIF_CHAN 10 |
| 124 | #define DMOV_TSIF_CRCI 10 |
| 125 | |
| 126 | #define DMOV_USB_CHAN 11 |
| 127 | |
| 128 | /* no client rate control ifc (eg, ram) */ |
| 129 | #define DMOV_NONE_CRCI 0 |
| 130 | |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 131 | /* If the CMD_PTR register has CMD_PTR_LIST selected, the data mover |
| 132 | ** is going to walk a list of 32bit pointers as described below. Each |
| 133 | ** pointer points to a *array* of dmov_s, etc structs. The last pointer |
| 134 | ** in the list is marked with CMD_PTR_LP. The last struct in each array |
| 135 | ** is marked with CMD_LC (see below). |
| 136 | */ |
| 137 | #define CMD_PTR_ADDR(addr) ((addr) >> 3) |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 138 | #define CMD_PTR_LP (1 << 31) /* last pointer */ |
| 139 | #define CMD_PTR_PT (3 << 29) /* ? */ |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 140 | |
| 141 | /* Single Item Mode -- seems to work as expected */ |
| 142 | typedef struct { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 143 | unsigned cmd; |
| 144 | unsigned src; |
| 145 | unsigned dst; |
| 146 | unsigned len; |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 147 | } dmov_s; |
| 148 | |
| 149 | /* Scatter/Gather Mode -- does this work?*/ |
| 150 | typedef struct { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 151 | unsigned cmd; |
| 152 | unsigned src_dscr; |
| 153 | unsigned dst_dscr; |
| 154 | unsigned _reserved; |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 155 | } dmov_sg; |
| 156 | |
| 157 | /* bits for the cmd field of the above structures */ |
| 158 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 159 | #define CMD_LC (1 << 31) /* last command */ |
| 160 | #define CMD_FR (1 << 22) /* force result -- does not work? */ |
| 161 | #define CMD_OCU (1 << 21) /* other channel unblock */ |
| 162 | #define CMD_OCB (1 << 20) /* other channel block */ |
| 163 | #define CMD_TCB (1 << 19) /* ? */ |
| 164 | #define CMD_DAH (1 << 18) /* destination address hold -- does not work? */ |
| 165 | #define CMD_SAH (1 << 17) /* source address hold -- does not work? */ |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 166 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 167 | #define CMD_MODE_SINGLE (0 << 0) /* dmov_s structure used */ |
| 168 | #define CMD_MODE_SG (1 << 0) /* untested */ |
| 169 | #define CMD_MODE_IND_SG (2 << 0) /* untested */ |
| 170 | #define CMD_MODE_BOX (3 << 0) /* untested */ |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 171 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 172 | #define CMD_DST_SWAP_BYTES (1 << 14) /* exchange each byte n with byte n+1 */ |
| 173 | #define CMD_DST_SWAP_SHORTS (1 << 15) /* exchange each short n with short n+1 */ |
| 174 | #define CMD_DST_SWAP_WORDS (1 << 16) /* exchange each word n with word n+1 */ |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 175 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 176 | #define CMD_SRC_SWAP_BYTES (1 << 11) /* exchange each byte n with byte n+1 */ |
| 177 | #define CMD_SRC_SWAP_SHORTS (1 << 12) /* exchange each short n with short n+1 */ |
| 178 | #define CMD_SRC_SWAP_WORDS (1 << 13) /* exchange each word n with word n+1 */ |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 179 | |
| 180 | #define CMD_DST_CRCI(n) (((n) & 15) << 7) |
| 181 | #define CMD_SRC_CRCI(n) (((n) & 15) << 3) |
| 182 | |
Dima Zavin | 03cf431 | 2009-01-23 16:38:30 -0800 | [diff] [blame] | 183 | /* NOTES: |
| 184 | ** |
| 185 | ** Looks like Channels 4, 5, 6, 7, 8, 10, 11 are available to the ARM11 |
| 186 | ** |
| 187 | */ |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 188 | #endif /* __PLATFORM_MSM_SHARED_DMOV_H */ |