Commit 33fd41951a8bf61be33b2b793a2c87a62eb0c1cf
Committed by
Tom Rini
1 parent
790d5b3670
Exists in
smarc_8mq_lf_v2020.04
and in
9 other branches
remoteproc: stm32: load resource table from firmware
Load the optional resource table from the firmware, and write its address in the dedicated backup register. Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com> Acked-by: Patrick Delaunay <patrick.delaunay@st.com>
Showing 1 changed file with 16 additions and 0 deletions Side-by-side Diff
drivers/remoteproc/stm32_copro.c
... | ... | @@ -22,12 +22,14 @@ |
22 | 22 | * @hold_boot_regmap: regmap for remote processor reset hold boot |
23 | 23 | * @hold_boot_offset: offset of the register controlling the hold boot setting |
24 | 24 | * @hold_boot_mask: bitmask of the register for the hold boot field |
25 | + * @rsc_table_addr: resource table address | |
25 | 26 | */ |
26 | 27 | struct stm32_copro_privdata { |
27 | 28 | struct reset_ctl reset_ctl; |
28 | 29 | struct regmap *hold_boot_regmap; |
29 | 30 | uint hold_boot_offset; |
30 | 31 | uint hold_boot_mask; |
32 | + ulong rsc_table_addr; | |
31 | 33 | }; |
32 | 34 | |
33 | 35 | /** |
... | ... | @@ -139,6 +141,7 @@ |
139 | 141 | static int stm32_copro_load(struct udevice *dev, ulong addr, ulong size) |
140 | 142 | { |
141 | 143 | struct stm32_copro_privdata *priv; |
144 | + ulong rsc_table_size; | |
142 | 145 | int ret; |
143 | 146 | |
144 | 147 | priv = dev_get_priv(dev); |
... | ... | @@ -153,6 +156,12 @@ |
153 | 156 | return ret; |
154 | 157 | } |
155 | 158 | |
159 | + if (rproc_elf32_load_rsc_table(dev, addr, size, &priv->rsc_table_addr, | |
160 | + &rsc_table_size)) { | |
161 | + priv->rsc_table_addr = 0; | |
162 | + dev_warn(dev, "No valid resource table for this firmware\n"); | |
163 | + } | |
164 | + | |
156 | 165 | return rproc_elf32_load_image(dev, addr, size); |
157 | 166 | } |
158 | 167 | |
159 | 168 | |
... | ... | @@ -163,8 +172,11 @@ |
163 | 172 | */ |
164 | 173 | static int stm32_copro_start(struct udevice *dev) |
165 | 174 | { |
175 | + struct stm32_copro_privdata *priv; | |
166 | 176 | int ret; |
167 | 177 | |
178 | + priv = dev_get_priv(dev); | |
179 | + | |
168 | 180 | /* move hold boot from true to false start the copro */ |
169 | 181 | ret = stm32_copro_set_hold_boot(dev, false); |
170 | 182 | if (ret) |
... | ... | @@ -177,6 +189,10 @@ |
177 | 189 | ret = stm32_copro_set_hold_boot(dev, true); |
178 | 190 | writel(ret ? TAMP_COPRO_STATE_OFF : TAMP_COPRO_STATE_CRUN, |
179 | 191 | TAMP_COPRO_STATE); |
192 | + if (!ret) | |
193 | + /* Store rsc_address in bkp register */ | |
194 | + writel(priv->rsc_table_addr, TAMP_COPRO_RSC_TBL_ADDRESS); | |
195 | + | |
180 | 196 | return ret; |
181 | 197 | } |
182 | 198 |