1 /*
2 * Copyright (c) 2017-2018, Texas Instruments Incorporated
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 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
33 /*
34 * ======== rsc_table_am65xx_r5f.h ========
35 *
36 * Define the resource table entries for all R5F cores. This will be
37 * incorporated into corresponding base images, and used by the remoteproc
38 * on the host-side to allocated/reserve resources.
39 *
40 */
42 #ifndef _RSC_TABLE_AM65XX_R5F_H_
43 #define _RSC_TABLE_AM65XX_R5F_H_
45 #include "rsc_types.h"
47 #define R5F_MEM_TEXT 0x9C200000
48 #define R5F_MEM_DATA 0x9C300000
50 #define R5F_MEM_IPC_DATA 0x9C100000
51 #define R5F_MEM_IPC_VRING 0x9C000000
52 #define R5F_MEM_RPMSG_VRING0 0x9C000000
53 #define R5F_MEM_RPMSG_VRING1 0x9C010000
54 #define R5F_MEM_VRING_BUFS0 0x9C040000
55 #define R5F_MEM_VRING_BUFS1 0x9C080000
57 #define R5F_MEM_IPC_VRING_SIZE SZ_1M
58 #define R5F_MEM_IPC_DATA_SIZE (SZ_1M)
60 #define R5F_MEM_TEXT_SIZE (SZ_1M)
62 #define R5F_MEM_DATA_SIZE (SZ_1M)
64 #define R5F_NUM_ENTRIES 6
66 /*
67 * Assign fixed RAM addresses to facilitate a fixed MMU table.
68 * PHYS_MEM_IPC_VRING & PHYS_MEM_IPC_DATA MUST be together.
69 */
70 /* See CMA BASE addresses in Linux side: arch/arm/mach-omap2/remoteproc.c */
71 #define PHYS_MEM_IPC_VRING 0x9C000000
73 /*
74 * Sizes of the virtqueues (expressed in number of buffers supported,
75 * and must be power of 2)
76 */
77 #define R5F_RPMSG_VQ0_SIZE 256
78 #define R5F_RPMSG_VQ1_SIZE 256
80 /* flip up bits whose indices represent features we support */
81 #define RPMSG_R5F_C0_FEATURES 1
83 struct my_resource_table {
84 struct resource_table base;
86 UInt32 offset[R5F_NUM_ENTRIES]; /* Should match 'num' in actual definition */
88 /* rpmsg vdev entry */
89 struct fw_rsc_vdev rpmsg_vdev;
90 struct fw_rsc_vdev_vring rpmsg_vring0;
91 struct fw_rsc_vdev_vring rpmsg_vring1;
93 /* ipcdata carveout entry */
94 struct fw_rsc_carveout ipcdata_cout;
96 /* text carveout entry */
97 struct fw_rsc_carveout text_cout;
99 /* data carveout entry */
100 struct fw_rsc_carveout data_cout;
102 /* trace entry */
103 struct fw_rsc_trace trace;
105 /* devmem entry */
106 struct fw_rsc_devmem devmem0;
107 };
109 #define TRACEBUFADDR (UInt32)&ti_trace_SysMin_Module_State_0_outbuf__A
111 #pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
112 #pragma DATA_ALIGN(ti_ipc_remoteproc_ResourceTable, 4096)
114 const struct my_resource_table ti_ipc_remoteproc_ResourceTable = {
115 1, /* we're the first version that implements this */
116 R5F_NUM_ENTRIES, /* number of entries in the table */
117 0, 0, /* reserved, must be zero */
118 /* offsets to entries */
119 {
120 offsetof(struct my_resource_table, rpmsg_vdev),
121 offsetof(struct my_resource_table, ipcdata_cout),
122 offsetof(struct my_resource_table, text_cout),
123 offsetof(struct my_resource_table, data_cout),
124 offsetof(struct my_resource_table, trace),
125 offsetof(struct my_resource_table, devmem0),
126 },
128 /* rpmsg vdev entry */
129 {
130 TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
131 RPMSG_R5F_C0_FEATURES, 0, 0, 0, 2, { 0, 0 },
132 /* no config data */
133 },
134 /* the two vrings */
135 { R5F_MEM_RPMSG_VRING0, 4096, R5F_RPMSG_VQ0_SIZE, 1, 0 },
136 { R5F_MEM_RPMSG_VRING1, 4096, R5F_RPMSG_VQ1_SIZE, 2, 0 },
138 {
139 TYPE_CARVEOUT,
140 R5F_MEM_IPC_DATA, 0,
141 R5F_MEM_IPC_DATA_SIZE, 0, 0, "R5F_MEM_IPC_DATA",
142 },
144 {
145 TYPE_CARVEOUT,
146 R5F_MEM_TEXT, 0,
147 R5F_MEM_TEXT_SIZE, 0, 0, "R5F_MEM_TEXT",
148 },
150 {
151 TYPE_CARVEOUT,
152 R5F_MEM_DATA, 0,
153 R5F_MEM_DATA_SIZE, 0, 0, "R5F_MEM_DATA",
154 },
156 {
157 TYPE_TRACE, TRACEBUFADDR, 0x8000, 0, "trace:r5f0",
158 },
160 {
161 TYPE_DEVMEM,
162 R5F_MEM_IPC_VRING, PHYS_MEM_IPC_VRING,
163 R5F_MEM_IPC_VRING_SIZE, 0, 0, "R5F_MEM_IPC_VRING",
164 },
166 };
168 #endif /* _RSC_TABLE_AM65XX_R5F_H_ */