layerscape: add ls1088ardb device support
[openwrt/staging/lynxis/omap.git] / target / linux / layerscape / patches-4.4 / 7169-staging-fsl-mc-update-dprc-binary-interface-to-v5.1.patch
1 From 45dce4cd82ddc618ade56747620a2a29f7d9a99d Mon Sep 17 00:00:00 2001
2 From: Stuart Yoder <stuart.yoder@nxp.com>
3 Date: Mon, 11 Apr 2016 11:48:59 -0500
4 Subject: [PATCH 169/226] staging: fsl-mc: update dprc binary interface to
5 v5.1
6
7 The meaning of the "status" parameter in dprc_get_irq_status
8 has changed, and this patch updates the flib and caller
9 of the API.
10
11 Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
12 Acked-by: German Rivera <german.rivera@nxp.com>
13 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
14 ---
15 drivers/staging/fsl-mc/bus/dprc-cmd.h | 4 ++--
16 drivers/staging/fsl-mc/bus/dprc-driver.c | 1 +
17 drivers/staging/fsl-mc/bus/dprc.c | 26 +++++++++++++-------------
18 drivers/staging/fsl-mc/bus/mc-msi.c | 2 +-
19 drivers/staging/fsl-mc/include/dprc.h | 19 ++++++++++++-------
20 5 files changed, 29 insertions(+), 23 deletions(-)
21
22 --- a/drivers/staging/fsl-mc/bus/dprc-cmd.h
23 +++ b/drivers/staging/fsl-mc/bus/dprc-cmd.h
24 @@ -41,8 +41,8 @@
25 #define _FSL_DPRC_CMD_H
26
27 /* DPRC Version */
28 -#define DPRC_VER_MAJOR 4
29 -#define DPRC_VER_MINOR 0
30 +#define DPRC_VER_MAJOR 5
31 +#define DPRC_VER_MINOR 1
32
33 /* Command IDs */
34 #define DPRC_CMDID_CLOSE 0x800
35 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c
36 +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c
37 @@ -423,6 +423,7 @@ static irqreturn_t dprc_irq0_handler_thr
38 if (WARN_ON(!msi_desc || msi_desc->irq != (u32)irq_num))
39 goto out;
40
41 + status = 0;
42 error = dprc_get_irq_status(mc_io, 0, mc_dev->mc_handle, 0,
43 &status);
44 if (error < 0) {
45 --- a/drivers/staging/fsl-mc/bus/dprc.c
46 +++ b/drivers/staging/fsl-mc/bus/dprc.c
47 @@ -265,7 +265,7 @@ int dprc_get_irq(struct fsl_mc_io *mc_io
48 /* retrieve response parameters */
49 irq_cfg->val = mc_dec(cmd.params[0], 0, 32);
50 irq_cfg->paddr = mc_dec(cmd.params[1], 0, 64);
51 - irq_cfg->user_irq_id = mc_dec(cmd.params[2], 0, 32);
52 + irq_cfg->irq_num = mc_dec(cmd.params[2], 0, 32);
53 *type = mc_dec(cmd.params[2], 32, 32);
54
55 return 0;
56 @@ -296,7 +296,7 @@ int dprc_set_irq(struct fsl_mc_io *mc_io
57 cmd.params[0] |= mc_enc(32, 8, irq_index);
58 cmd.params[0] |= mc_enc(0, 32, irq_cfg->val);
59 cmd.params[1] |= mc_enc(0, 64, irq_cfg->paddr);
60 - cmd.params[2] |= mc_enc(0, 32, irq_cfg->user_irq_id);
61 + cmd.params[2] |= mc_enc(0, 32, irq_cfg->irq_num);
62
63 /* send command to mc*/
64 return mc_send_command(mc_io, &cmd);
65 @@ -466,6 +466,7 @@ int dprc_get_irq_status(struct fsl_mc_io
66 /* prepare command */
67 cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_STATUS,
68 cmd_flags, token);
69 + cmd.params[0] |= mc_enc(0, 32, *status);
70 cmd.params[0] |= mc_enc(32, 8, irq_index);
71
72 /* send command to mc*/
73 @@ -948,6 +949,7 @@ int dprc_get_obj(struct fsl_mc_io *mc_io
74 obj_desc->state = mc_dec(cmd.params[1], 32, 32);
75 obj_desc->ver_major = mc_dec(cmd.params[2], 0, 16);
76 obj_desc->ver_minor = mc_dec(cmd.params[2], 16, 16);
77 + obj_desc->flags = mc_dec(cmd.params[2], 32, 16);
78 obj_desc->type[0] = mc_dec(cmd.params[3], 0, 8);
79 obj_desc->type[1] = mc_dec(cmd.params[3], 8, 8);
80 obj_desc->type[2] = mc_dec(cmd.params[3], 16, 8);
81 @@ -1042,6 +1044,7 @@ int dprc_get_obj_desc(struct fsl_mc_io *
82 obj_desc->state = (u32)mc_dec(cmd.params[1], 32, 32);
83 obj_desc->ver_major = (u16)mc_dec(cmd.params[2], 0, 16);
84 obj_desc->ver_minor = (u16)mc_dec(cmd.params[2], 16, 16);
85 + obj_desc->flags = mc_dec(cmd.params[2], 32, 16);
86 obj_desc->type[0] = (char)mc_dec(cmd.params[3], 0, 8);
87 obj_desc->type[1] = (char)mc_dec(cmd.params[3], 8, 8);
88 obj_desc->type[2] = (char)mc_dec(cmd.params[3], 16, 8);
89 @@ -1108,7 +1111,7 @@ int dprc_set_obj_irq(struct fsl_mc_io *m
90 cmd.params[0] |= mc_enc(32, 8, irq_index);
91 cmd.params[0] |= mc_enc(0, 32, irq_cfg->val);
92 cmd.params[1] |= mc_enc(0, 64, irq_cfg->paddr);
93 - cmd.params[2] |= mc_enc(0, 32, irq_cfg->user_irq_id);
94 + cmd.params[2] |= mc_enc(0, 32, irq_cfg->irq_num);
95 cmd.params[2] |= mc_enc(32, 32, obj_id);
96 cmd.params[3] |= mc_enc(0, 8, obj_type[0]);
97 cmd.params[3] |= mc_enc(8, 8, obj_type[1]);
98 @@ -1189,7 +1192,7 @@ int dprc_get_obj_irq(struct fsl_mc_io *m
99 /* retrieve response parameters */
100 irq_cfg->val = (u32)mc_dec(cmd.params[0], 0, 32);
101 irq_cfg->paddr = (u64)mc_dec(cmd.params[1], 0, 64);
102 - irq_cfg->user_irq_id = (int)mc_dec(cmd.params[2], 0, 32);
103 + irq_cfg->irq_num = (int)mc_dec(cmd.params[2], 0, 32);
104 *type = (int)mc_dec(cmd.params[2], 32, 32);
105
106 return 0;
107 @@ -1437,14 +1440,8 @@ EXPORT_SYMBOL(dprc_set_obj_label);
108 * @endpoint1: Endpoint 1 configuration parameters
109 * @endpoint2: Endpoint 2 configuration parameters
110 * @cfg: Connection configuration. The connection configuration is ignored for
111 - * connections made to DPMAC objects, where rate is set according to
112 - * MAC configuration.
113 - * The committed rate is the guaranteed rate for the connection.
114 - * The maximum rate is an upper limit allowed for the connection; it is
115 - * expected to be equal or higher than the committed rate.
116 - * When committed and maximum rates are both zero, the connection is set
117 - * to "best effort" mode, having lower priority compared to connections
118 - * with committed or maximum rates.
119 + * connections made to DPMAC objects, where rate is retrieved from the
120 + * MAC configuration.
121 *
122 * Return: '0' on Success; Error code otherwise.
123 */
124 @@ -1555,7 +1552,10 @@ int dprc_disconnect(struct fsl_mc_io *mc
125 * @token: Token of DPRC object
126 * @endpoint1: Endpoint 1 configuration parameters
127 * @endpoint2: Returned endpoint 2 configuration parameters
128 -* @state: Returned link state: 1 - link is up, 0 - link is down
129 +* @state: Returned link state:
130 +* 1 - link is up;
131 +* 0 - link is down;
132 +* -1 - no connection (endpoint2 information is irrelevant)
133 *
134 * Return: '0' on Success; -ENAVAIL if connection does not exist.
135 */
136 --- a/drivers/staging/fsl-mc/bus/mc-msi.c
137 +++ b/drivers/staging/fsl-mc/bus/mc-msi.c
138 @@ -65,7 +65,7 @@ static void __fsl_mc_msi_write_msg(struc
139 irq_cfg.paddr = ((u64)msi_desc->msg.address_hi << 32) |
140 msi_desc->msg.address_lo;
141 irq_cfg.val = msi_desc->msg.data;
142 - irq_cfg.user_irq_id = msi_desc->irq;
143 + irq_cfg.irq_num = msi_desc->irq;
144
145 if (owner_mc_dev == mc_bus_dev) {
146 /*
147 --- a/drivers/staging/fsl-mc/include/dprc.h
148 +++ b/drivers/staging/fsl-mc/include/dprc.h
149 @@ -94,11 +94,6 @@ int dprc_close(struct fsl_mc_io *mc_io,
150 */
151 #define DPRC_CFG_OPT_TOPOLOGY_CHANGES_ALLOWED 0x00000008
152
153 -/* IOMMU bypass - indicates whether objects of this container are permitted
154 - * to bypass the IOMMU.
155 - */
156 -#define DPRC_CFG_OPT_IOMMU_BYPASS 0x00000010
157 -
158 /* AIOP - Indicates that container belongs to AIOP. */
159 #define DPRC_CFG_OPT_AIOP 0x00000020
160
161 @@ -173,12 +168,12 @@ int dprc_reset_container(struct fsl_mc_i
162 * struct dprc_irq_cfg - IRQ configuration
163 * @paddr: Address that must be written to signal a message-based interrupt
164 * @val: Value to write into irq_addr address
165 - * @user_irq_id: A user defined number associated with this IRQ
166 + * @irq_num: A user defined number associated with this IRQ
167 */
168 struct dprc_irq_cfg {
169 phys_addr_t paddr;
170 u32 val;
171 - int user_irq_id;
172 + int irq_num;
173 };
174
175 int dprc_set_irq(struct fsl_mc_io *mc_io,
176 @@ -353,6 +348,14 @@ int dprc_get_obj_count(struct fsl_mc_io
177 #define DPRC_OBJ_STATE_PLUGGED 0x00000002
178
179 /**
180 + * Shareability flag - Object flag indicating no memory shareability.
181 + * the object generates memory accesses that are non coherent with other
182 + * masters;
183 + * user is responsible for proper memory handling through IOMMU configuration.
184 + */
185 +#define DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY 0x0001
186 +
187 +/**
188 * struct dprc_obj_desc - Object descriptor, returned from dprc_get_obj()
189 * @type: Type of object: NULL terminated string
190 * @id: ID of logical object resource
191 @@ -363,6 +366,7 @@ int dprc_get_obj_count(struct fsl_mc_io
192 * @region_count: Number of mappable regions supported by the object
193 * @state: Object state: combination of DPRC_OBJ_STATE_ states
194 * @label: Object label
195 + * @flags: Object's flags
196 */
197 struct dprc_obj_desc {
198 char type[16];
199 @@ -374,6 +378,7 @@ struct dprc_obj_desc {
200 u8 region_count;
201 u32 state;
202 char label[16];
203 + u16 flags;
204 };
205
206 int dprc_get_obj(struct fsl_mc_io *mc_io,